Why doesn't PHP pear work even with the correct include path?
Here is the error message that I get
Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.:/usr/share/psa-pear/:/usr/share/pear:/local/PEAR/')
Mail.php is here /usr/share/pear
I'm running Centos in a VPS with Plesk. The script works perfectly from the command line but dies in the browser.
Edit: permissions look ok
drwxr-xr-x 16 root root 4096 Jan 30 07:06 pear
Edit2:
after fishing around I think it's related to plesk as explained here
http://www.matteomattei.com/en/install-yum-and-php-pear-on-centos-5/
I have a bunch of include files
-rw-r----- 1 root apache 6648 Jan 31 20:06 12965206700.32285200_httpd.include
-rw-r----- 1 root apache 6532 Jan 31 15:54 12965108850.92819600_httpd.include
-rw-r----- 1 root apache 6532 Jan 31 07:01 12964788880.47252600_httpd.include
After editing the most recent one as fol开发者_开发百科lows
grep base 12965206700.32285200_httpd.include
php_admin_value open_basedir /var/www/vhosts/wor.wordswithfriends.net/httpdocs/:/tmp/:/usr/share/pear:/local/PEAR/
php_admin_value open_basedir /var/www/vhosts/wor.wordswithfriends.net/httpdocs/:/tmp/:/usr/share/pear:/local/PEAR/
php_admin_value open_basedir /var/www/vhosts/wor.wordswithfriends.net/httpdocs/:/tmp/:/usr/share/pear:/local/PEAR/
php_admin_value open_basedir /var/www/vhosts/wor.wordswithfriends.net/httpdocs/:/tmp/:/usr/share/pear:/local/PEAR/
And restarting. Still no joy
Check your file permission on that directory.
When you run PHP on the command line, you are running as yourself - but when you access through the browser, PHP is executed as the apache or www-data user.
You either need to allow read permission to world the pear directory (and all of its contents) or you give group read and then use chgrp to set it to apache or www-data (I'm not entirely sure which user is used on CentOS)
edit:
Additionally - you might want to include the trailing slash in your configuration - I notice that you have added it only as /usr/share/pear
- I don't generally change this ini value, so don't know if that makes a difference. Try /usr/share/pear/
The include path in php.ini
should be the value of this command:pear config-get php_dir
精彩评论