Welcome to WebmasterWorld Guest from 54.144.48.252

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Cannot find pear files

include shows error but file is there

     
12:18 pm on Jul 12, 2011 (gmt 0)

5+ Year Member



I am trying to install pear to use its mail functions

based on their instructions I edited php.ini to set an include_path to point to pear directory. I set it to:

'.:/usr/share/psa-pear/'


That part should be ok because this is the error I get:

Warning: require_once(System.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/vhosts/site.com/httpdocs/x.php on line 2

Fatal error: require_once() [function.require]: Failed opening required 'System.php' (include_path='.:/usr/share/psa-pear/') in /var/www/vhosts/site.com/httpdocs/x.php on line 2


So error says that include path is /usr/share/psa-pear/ and by SSH if I go to that path and to a "dir" or "ls" I can see "System.php" and the other files there.

Any tips? That include path in php.ini is formated correctly? ":" delimits multiple paths?
Tanks.
1:48 pm on Jul 12, 2011 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Yep, ":" delimits multiple paths on Linux (";" on Windows) - the value of the PATH_SEPARATOR constant.

Do you have permission to access "/usr/share/psa-pear/" from "/var/www/vhosts/site.com/httpdocs/"? Try specifying the full absolute path to check.
2:42 pm on Jul 12, 2011 (gmt 0)

5+ Year Member



I tried changing with "chown", I tried changing the php file that calls this and then the complete path, none of them helped, then I am thinking it should have said something about permission, but it simply says it can't find it. I found many users online with same problem, very frustrating.

Trying full path (like include("/usr/share/pear/System.php";) shows an additional "operation not permitted".
2:58 pm on Jul 12, 2011 (gmt 0)

5+ Year Member



Pff... I had to add the pear path to open_basedir by editing vhost.conf file (I use plesk).
Maybe someone else needs this, so I edited/created file:
/var/www/vhost/site.com/conf/vhost.conf

And inside it I placed this:
<Directory /var/www/vhosts/site.com/httpdocs/>
php_admin_value open_basedir "/var/www/vhosts/site.com/httpdocs/:/tmp/:/usr/share/pear"
php_admin_value include_path ".:/usr/share/pear"
</Directory>

Restarted with "/etc/init.d/httpd restart" and it found the pear include files.

Edit: to avoid confusion for others, I seem to have pear in both these locations:
/usr/share/psa-pear/
/usr/share/pear/
I think "psa" one came with plesk, the other was installed today.
3:07 pm on Jul 12, 2011 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Glad you got it sorted and thanks for the follow up.

...then I am thinking it should have said something about permission, but it simply says it can't find it.


I don't think PHP (at least at the user level) has any concept of permissions in this respect. If PHP can't see the file (for whatever underlying reason) it simply baulks with "...No such file or directory...".
3:19 pm on Jul 12, 2011 (gmt 0)

5+ Year Member



Well, I remember sometimes PHP does mention "open_basedir in effect" next to errors, it would have helped now :)
4:04 pm on Jul 12, 2011 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Hhhmmm yes, indeed! :)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month