homepage Welcome to WebmasterWorld Guest from 50.19.33.5
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Cannot find pear files
include shows error but file is there
adrianTNT




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

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.

 

penders




msg:4338493
 1:48 pm on Jul 12, 2011 (gmt 0)

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




msg:4338518
 2:42 pm on Jul 12, 2011 (gmt 0)

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".

adrianTNT




msg:4338524
 2:58 pm on Jul 12, 2011 (gmt 0)

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.

penders




msg:4338529
 3:07 pm on Jul 12, 2011 (gmt 0)

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




msg:4338534
 3:19 pm on Jul 12, 2011 (gmt 0)

Well, I remember sometimes PHP does mention "open_basedir in effect" next to errors, it would have helped now :)

penders




msg:4338548
 4:04 pm on Jul 12, 2011 (gmt 0)

Hhhmmm yes, indeed! :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved