无法在Ubuntu上安装PEAR邮件

时间:2014-02-13 11:15:18

标签: php email pear

我不知道以前有没有人经历过这个。我试图安装PEAR Mail,以便我可以使用外部服务器发送电子邮件。但是当我输入以下命令时,我不断收到错误消息:

:~# 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 <info@me.org>";
 $to = "Ramona Recipient <some@somedomain.com>";
 $subject = "Hi!";
 $body = "Hi,\n\nHow are you?";

 $host = "ssl://xxx.xxx.xxx";
 $port = "465";
 $username = "me@domain.org";
 $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运行也没有用 :〜#pear install --alldeps 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
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

1 个答案:

答案 0 :(得分:1)

您的下载目录似乎设置为/build/buildd/php5-5.3.2/pear-build-download,这是不可写的。

所以你需要使用chmod使其可写:

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

您的pear配置中的设置甚至可能是系统以前版本的遗留物,因此您可能需要重新创建该目录结构,然后执行chmod:

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