【问题标题】:Cannot installing PEAR mail on Ubuntu无法在 Ubuntu 上安装 PEAR 邮件
【发布时间】:2014-03-12 05:39:15
【问题描述】:

不知道有没有人经历过。我试图安装 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

【问题讨论】:

  • 试试 PEAR 提示你的东西:--alldeps。所以pear install --alldeps Mail Mail_Mime
  • 感谢 Samuel,它仍然会溢出错误消息。
  • 更新您的帖子并使用 --alldeps 调用显示消息

标签: php email pear


【解决方案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

【讨论】:

  • 谢谢。我已经切换到 PHPMailer - 它更容易安装和使用。
猜你喜欢
  • 2017-01-30
  • 1970-01-01
  • 2014-01-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-07-27
  • 2018-12-03
  • 2012-02-10
相关资源
最近更新 更多