You are here: Migration from php4 to php 5 open_basedir directive. « PHP « IT news, forums, messages
Migration from php4 to php 5 open_basedir directive.

Posted by Craig Lewis on 03/14/05 18:11

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация