Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 136,047 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,544 people online right now. Registration is fast and FREE... Join Now!




unable to *include* pear modules through browser

 
Reply to this topicStart new topic

unable to *include* pear modules through browser, require_once failing at browser with open_basedir complaint

davidh
21 Jul, 2008 - 07:44 PM
Post #1

New D.I.C Head
*

Joined: 21 Jul, 2008
Posts: 2


My Contributions
Hi,

I'm confused. I admit it.

I have installed Pear and while my question involves getting it to work, this is really a PHP question as I understand it.

"How do I have to change my configuration to allow PHP to include /usr/lib/php/pear/PEAR/Mail.php when being called via a browser?"

- phpinfo() currently reports the include_path (LOCAL) as .:/usr/lib/php/pear/PEAR:
- phpinfo() currently reports the include_path (MASTER) as .:/usr/lib/php/pear/PEAR:
- phpinfo() currently reports open_basedir (LOCAL) as /var/www/vhosts/domain.com/httpdocs:/tmp:/usr/lib/php/pear/PEAR:
- phpinfo() currently reports open_basedir (MASTER) as /usr/lib/php/pear/PEAR

Some very simple PHP code:

<?php require_once 'Mail.php'; ?>

won't complete because /usr/lib/php/pear/PEAR/Mail.php isn't readable.

The error_log reports:

[Mon Jul 21 22:39:08 2008] [error] [client x.x.x.x] PHP Warning: require_once(Mail.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in /var/www/vhosts/domain.com/httpdocs/ms.htm on line 7
[Mon Jul 21 22:39:08 2008] [error] [client x.x.x.x] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'Mail.php' (include_path='.:/usr/lib/php/pear/PEAR:') in /var/www/vhosts/domain.com/httpdocs/ms.htm on line 7

Some PHP code to determine 'readability' using is_readable()...

- Shows proper settings/readability from the command line:

# php readable.php
/usr/lib/php/pear/PEAR/Mail.php is readable ** <br>/usr/lib/php/pear/PEAR is readable ** <br>/usr/lib/php/pear is PHP Warning: is_readable(): open_basedir restriction in effect. File(/usr/lib/php/pear) is not within the allowed path(s): (/usr/lib/php/pear/PEAR) in /var/www/vhosts/domain.com/httpdocs/readable.php on line 13
not readable ** <br>/usr/lib/php is PHP Warning: is_readable(): open_basedir restriction in effect. File(/usr/lib/php) is not within the allowed path(s): (/usr/lib/php/pear/PEAR) in /var/www/vhosts/domain.com/httpdocs/readable.php on line 13
not readable ** <br>/usr/lib is PHP Warning: is_readable(): open_basedir restriction in effect. File(/usr/lib) is not within the allowed path(s): (/usr/lib/php/pear/PEAR) in /var/www/vhosts/domain.com/httpdocs/readable.php on line 13
not readable ** <br>/usr is PHP Warning: is_readable(): open_basedir restriction in effect. File(/usr) is not within the allowed path(s): (/usr/lib/php/pear/PEAR) in /var/www/vhosts/domain.com/httpdocs/readable.php on line 13
not readable ** <br>

- but fails within a browser:

/usr/lib/php/pear/PEAR/Mail.php is not readable **
/usr/lib/php/pear/PEAR is not readable **
/usr/lib/php/pear is not readable **
/usr/lib/php is not readable **
/usr/lib is not readable **
/usr is not readable **


- generating:

[Mon Jul 21 00:44:32 2008] [error] [client w.x.y.z] PHP Warning: is_readable() [<a href='function.is-readable'>function.is-readable</a>]: open_basedir restriction in effect. File(/usr/lib/php/pear/PEAR) is not within the allowed path(s): (/var/www/vhosts/domain.com/httpdocs:/tmp:/usr/lib/php/pear/PEAR) in /var/www/vhosts/domain.com/httpdocs/readable.php on line 13

******

Yes, that says "File(/usr/lib/php/pear/PEAR) is not within the allowed path(s): (...:/usr/lib/php/pear/PEAR). Did I mention that I was confused?

For kicks I tried adding a trailing slash (i.e. /usr/lib/php/pear/PEAR/) in "all the right places", but no dice.

I'm open to ideas. Any thoughts?

Thanks hugely, in advance.

David
User is offlineProfile CardPM
+Quote Post

davidh
RE: Unable To *include* Pear Modules Through Browser
23 Jul, 2008 - 11:17 AM
Post #2

New D.I.C Head
*

Joined: 21 Jul, 2008
Posts: 2


My Contributions
Umm, am I posting in the wrong place? If so, can someone point me in the right direction?

Maybe some actual code (though essentially irrelevant) would be helpful:

CODE

<?php
$filename = '/usr/lib/php/pear/PEAR/Mail.php';
while ($filename != '/')
  {
  echo $filename, ' is ', is_readable($filename) ? '' : 'not ', 'readable  **  <br>';
$filename = dirname($filename);
  }
?>


If I'm missing anything that would help pinpoint the problem, please let me know.

Thanks,

David

This post has been edited by davidh: 23 Jul, 2008 - 11:18 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 05:24PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month