I'm having trouble using the Mail package from PEAR.
I have PHP Version 5.2.8 installed (php-fpm used toghether with nginx)

$ pear version
PEAR Version: 1.7.2
PHP Version: 5.2.8-1hardy~ppa1

$ pear list
Package          Version State
Mail             1.1.14  stable

$ pear config-get php_dir

$ ls /usr/share/php/Mail.php

phpinfo() says:

include_path .:/usr/share/php

Everything seems fine, but when I try to

require_once "Mail.php";

I get:

Warning: require_once(Mail.php) [function.require-once]: failed to open stream: No such file or directory in /home.. on line 2
Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.:/usr/share/php') in /home.. on line 2

Am I missing something?


3 Answers 3


Turns out it was a open_basedir issue, which had the path /usr/share/pear instead of /usr/share/php.
I got it when I tried to require_once "/usr/share/php/Mail.php" and got an open_basedir error.
Changing it in /etc/php5/fpm.conf solved my problem.

  • Good to hear that you solved it :)
    – rkthkr
    Jun 18, 2009 at 11:24

Edit your php.ini and look for the paths and directories info. Add /usr/share/php/PEAR to include_path=, mine says:

include_path = ".:/usr/share/php:/usr/share/php/PEAR"
  • I tried it out. I set the include_path to ".:/usr/share/php:/usr/share/php/PEAR", but I still get the same error (the path changed).
    – andi
    Jun 18, 2009 at 9:47
  • Where is the Mail.php file located?
    – rkthkr
    Jun 18, 2009 at 10:17
  • /usr/share/php/Mail.php
    – andi
    Jun 18, 2009 at 10:26
  • I finally found out what was causing my error. Thanks for the answer anyway.
    – andi
    Jun 18, 2009 at 11:16

I had the same/similar problemo.

I resoved by via http://markstechstuff.blogspot.com/2009/04/installing-pear-mail-for-php-on-ubuntu.html

You may want to change the order of install however. mail seems to depend on the things listed below. My installation process was not smoothe.

But this resolve my Mail.php not being found.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.