Helen Neely
Helen Neely

Reputation: 4740

Cannot installing PEAR mail on Ubuntu

I don't know if anyone has experienced this before. I was trying to install PEAR Mail so that I can use external server to send emails. But i keep getting error message when I enter the following command:

:~# pear install Mail Mail_Mime

Here is the error message:

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

Is there anything I'm doing wrong? I'm working on 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>");
  } 
 ?>

Any help would be very appreciated.

Update: Running with -alldeps did not help as well :~# 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

Upvotes: 2

Views: 2204

Answers (1)

kguest
kguest

Reputation: 3844

It appears that you have the download directory set to /build/buildd/php5-5.3.2/pear-build-download which is unwritable.

So you need to make it writable by using chmod:

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

It is even possible that setting in your pear config is a legacy from some previous release of your system, so you may need to recreate that directory structure, and then do the chmod:

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

Upvotes: 1

Related Questions