2014-02-13 84 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 - 安装和使用起来要容易得多。 –