2014-02-13 125 views
1

我不知道以前是否有人遇到過這種情況。我試圖安裝PEAR Mail,以便我可以使用外部服務器發送電子郵件。但我不斷收到錯誤消息,當我輸入以下命令:無法在Ubuntu上安裝PEAR郵件

:~# pear install Mail Mail_Mime 

以下是錯誤消息:

Warning: mkdir(): File exists in System.php on line 277 
PHP Warning: mkdir(): File exists in /usr/share/php/System.php on line 277 

Warning: mkdir(): Not a directory in System.php on line 277 
PHP Warning: mkdir(): Not a directory in /usr/share/php/System.php on line 277 
Did not download optional dependencies: pear/Net_SMTP, use --alldeps to download automatically 
pear/Mail can optionally use package "pear/Net_SMTP" (version >= 1.4.1) 

Warning: mkdir(): File exists in System.php on line 277 
PHP Warning: mkdir(): File exists in /usr/share/php/System.php on line 277 

Warning: mkdir(): Not a directory in System.php on line 277 
PHP Warning: mkdir(): Not a directory in /usr/share/php/System.php on line 277 
download directory "/build/buildd/php5-5.3.2/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir 
Error: cannot download "pear/Mail" 

Warning: mkdir(): File exists in System.php on line 277 
PHP Warning: mkdir(): File exists in /usr/share/php/System.php on line 277 

Warning: mkdir(): Not a directory in System.php on line 277 
PHP Warning: mkdir(): Not a directory in /usr/share/php/System.php on line 277 
download directory "/build/buildd/php5-5.3.2/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir 
Error: cannot download "pear/Mail_Mime" 
Download failed 
install failed 

有什麼我做錯了嗎?我正在研究Ubuntu。

<?php 

    require_once "Mail.php"; 

$from = "Sandra Sender <[email protected]>"; 
$to = "Ramona Recipient <[email protected]>"; 
$subject = "Hi!"; 
$body = "Hi,\n\nHow are you?"; 

$host = "ssl://xxx.xxx.xxx"; 
$port = "465"; 
$username = "[email protected]"; 
$password = "password"; 

$headers = array ('From' => $from, 
    'To' => $to, 
    'Subject' => $subject); 
$smtp = Mail::factory('smtp', 
    array ('host' => $host, 
    'port' => $port, 
    'auth' => true, 
    'username' => $username, 
    'password' => $password)); 

$mail = $smtp->send($to, $headers, $body); 

if (PEAR::isError($mail)) { 
    echo("<p>" . $mail->getMessage() . "</p>"); 
    } else { 
    echo("<p>Message successfully sent!</p>"); 
    } 
?> 

任何幫助將不勝感激。

更新: 與-alldeps運行沒有幫助以及 :〜#梨安裝--alldeps郵件Mail_Mime

Warning: mkdir(): File exists in System.php on line 277 
PHP Warning: mkdir(): File exists in /usr/share/php/System.php on line 277 

Warning: mkdir(): Not a directory in System.php on line 277 
PHP Warning: mkdir(): Not a directory in /usr/share/php/System.php on line 277 
WARNING: "pear/Auth_SASL" is deprecated in favor of "pear/Auth_SASL2" 

Warning: mkdir(): File exists in System.php on line 277 
PHP Warning: mkdir(): File exists in /usr/share/php/System.php on line 277 

Warning: mkdir(): Not a directory in System.php on line 277 
PHP Warning: mkdir(): Not a directory in /usr/share/php/System.php on line 277 
download directory "/build/buildd/php5-5.3.2/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir 
Error: cannot download "pear/Mail" 

Warning: mkdir(): File exists in System.php on line 277 
PHP Warning: mkdir(): File exists in /usr/share/php/System.php on line 277 

Warning: mkdir(): Not a directory in System.php on line 277 
PHP Warning: mkdir(): Not a directory in /usr/share/php/System.php on line 277 
download directory "/build/buildd/php5-5.3.2/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir 
Error: cannot download "pear/Mail_Mime" 

Warning: mkdir(): File exists in System.php on line 277 
PHP Warning: mkdir(): File exists in /usr/share/php/System.php on line 277 

Warning: mkdir(): Not a directory in System.php on line 277 
PHP Warning: mkdir(): Not a directory in /usr/share/php/System.php on line 277 
download directory "/build/buildd/php5-5.3.2/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir 
Error: cannot download "pear/Net_SMTP" 

Warning: mkdir(): File exists in System.php on line 277 
PHP Warning: mkdir(): File exists in /usr/share/php/System.php on line 277 

Warning: mkdir(): Not a directory in System.php on line 277 
PHP Warning: mkdir(): Not a directory in /usr/share/php/System.php on line 277 
download directory "/build/buildd/php5-5.3.2/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir 
Error: cannot download "pear/Net_Socket" 

Warning: mkdir(): File exists in System.php on line 277 
PHP Warning: mkdir(): File exists in /usr/share/php/System.php on line 277 

Warning: mkdir(): Not a directory in System.php on line 277 
PHP Warning: mkdir(): Not a directory in /usr/share/php/System.php on line 277 
download directory "/build/buildd/php5-5.3.2/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir 
Error: cannot download "pear/Auth_SASL" 
Download failed 
install failed 
+0

試試PEAR暗示你的東西:'--alldeps'。所以'梨安裝--alldeps Mail Mail_Mime' – Samuel

+0

謝謝塞繆爾,它仍然泄漏出錯信息。 –

+0

更新您的文章並使用--alldeps調用 – Samuel

回答

1

看來,你必須下載目錄設置爲/編譯/ buildd /php5-5.3.2/pear-build-download這是不可寫的。

所以,你需要使它可寫的使用chmod:

# chmod -R 777 /build/buildd/php5-5.3.2/pear-build-download 

甚至可以在你的梨配置設置是從系統的某些先前版本的傳統,所以你可能需要重新創建目錄結構,然後做chmod:

# mkdir -p /build/buildd/php5-5.3.2/pear-build-download 
+0

顯示消息謝謝。我已經切換到PHPMailer - 安裝和使用起來要容易得多。 –