Re: [PHP] Migration from php4 to php 5 open_basedir directive.

2005-03-14 Thread Craig Lewis

The files in question are 'within' the open_basedir directive.
To explain further/better
within virtualhost,
php_admin_value open_basedir /www/htdocs/midwifefinder.com/site
and...
/www/htdocs/midwifefinder.com/site/index.php contains
===

require_once("includes/app.php");

which is /www/htdocs/midwifefinder.com/site/includes/app.php and this 
file contains

===

but I have tried this with simple file names and a simpler structure, 
the contents of add.php is
parsed, and the contents of config/_config.php is never parsed.

why not just add the necessary directories to the open_basedir setting
(I'm guessing it can take multiple dirs because the error says 
'allowed path(s)')?
e.g.:
/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Migration from php4 to php 5 open_basedir directive.

2005-03-14 Thread Jochem Maas
Craig Lewis wrote:
Hello,
I have just attempted to migrate for the first time from  php4 to php5. 
The problem i am having is some sort of change in how the open_basedir 
directive works in php 5. I don't see much discussion about this, so I 
must be doing something stupid, otherwise, I would think there would be 
a lot of people bumping into this.

On both servers I have safe mode on and open_basedir directive set for 
the virtual host in apache. The offending php code from the top level 
file calls another php file with require_once ('path/file.php') and then 
file.php in turn calls another php file require_once ('path/file2'). Its 
this second require_once that causes the fatal  error, in otherwords, I 
can call the first file with require_once, and put just about any sort 
of reasonable php code in this file, and it works, i.e. its included in 
the origional file. When the called file, calls another file, in php 5, 
I get an error,

==
Warning: main() [function.main]: open_basedir restriction in effect. 
File(/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php) is 
not within the allowed path(s): (/www/htdocs/midwifefinder.com/site) in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3
the way I read it your config only allows you to open files inside of:
/www/htdocs/midwifefinder.com/site
looks to me like php5 is doing what its supposed to, maybe php4
was actually broken which allowed the require to work when it
wasn't supposed to.
why not just add the necessary directories to the open_basedir setting
(I'm guessing it can take multiple dirs because the error says 'allowed 
path(s)')?
e.g.:
/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php
 ^--- ? 
Warning: main(config/_config.inc.php) [function.main]: failed to open 
stream: Operation not permitted in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3

Fatal error: main() [function.require]: Failed opening required 
'config/_config.inc.php' 
(include_path='.:/usr/local/pkg/php/php-5.0.2//lib/php') in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3


The code and paths are unchanged, works on php4, not on php5, apache  
version unchanged. (1.3.x). I have tried various php.ini files, of 
course turning open_basedir off will make the error go away. The file 
being called is clearly within the scope of the open_basedir 
restriction, and thus it works just fine in php4.

/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php is not the 
correct path to the file, I guess because it doesn't find the file in 
the . (dot) part of the include path, then it blows up when it tries to 
find the file in (what is basically) /usr/local/lib/php.

This kind of sounds like a TRANSPATH related problem, and its certainly 
a path problem (where is dot), but as I read the docs, TRANSPATH is 
something that changed for apache 2.

Any advice would be appreciated.
CL
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Migration from php4 to php 5 open_basedir directive.

2005-03-14 Thread Craig Lewis
Hello,
I have just attempted to migrate for the first time from  php4 to php5. 
The problem i am having is some sort of change in how the open_basedir 
directive works in php 5. I don't see much discussion about this, so I 
must be doing something stupid, otherwise, I would think there would be 
a lot of people bumping into this.

On both servers I have safe mode on and open_basedir directive set for 
the virtual host in apache. The offending php code from the top level 
file calls another php file with require_once ('path/file.php') and then 
file.php in turn calls another php file require_once ('path/file2'). Its 
this second require_once that causes the fatal  error, in otherwords, I 
can call the first file with require_once, and put just about any sort 
of reasonable php code in this file, and it works, i.e. its included in 
the origional file. When the called file, calls another file, in php 5, 
I get an error,

==
Warning: main() [function.main]: open_basedir restriction in effect. 
File(/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php) is 
not within the allowed path(s): (/www/htdocs/midwifefinder.com/site) in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3

Warning: main(config/_config.inc.php) [function.main]: failed to open 
stream: Operation not permitted in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3

Fatal error: main() [function.require]: Failed opening required 
'config/_config.inc.php' 
(include_path='.:/usr/local/pkg/php/php-5.0.2//lib/php') in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3


The code and paths are unchanged, works on php4, not on php5, apache  
version unchanged. (1.3.x). I have tried various php.ini files, of 
course turning open_basedir off will make the error go away. The file 
being called is clearly within the scope of the open_basedir 
restriction, and thus it works just fine in php4.

/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php is not the 
correct path to the file, I guess because it doesn't find the file in 
the . (dot) part of the include path, then it blows up when it tries to 
find the file in (what is basically) /usr/local/lib/php.

This kind of sounds like a TRANSPATH related problem, and its certainly 
a path problem (where is dot), but as I read the docs, TRANSPATH is 
something that changed for apache 2.

Any advice would be appreciated.
CL
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php