Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Cannot find pear files include shows error but file is there adrianTNT
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:
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.
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. adrianTNT
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".
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.
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...". adrianTNT
Well, I remember sometimes PHP does mention "open_basedir in effect" next to errors, it would have helped now :) penders
Hhhmmm yes, indeed! :)