You are here: Include wierdness. « PHP « IT news, forums, messages
Include wierdness.

Posted by Rob Adams on 03/04/05 17:55

From the manual on 'include':

"Files for including are first looked in include_path relative to the
current working directory and then in include_path relative to the directory
of current script. E.g. if your include_path is ., current working directory
is /www/, you included include/a.php and there is include "b.php" in that
file, b.php is first looked in /www/ and then in /www/include/."

I have a file in my root dir (we'll call it /www) that includes the file
/www/lib/test.php as follows:
include('lib/test.php');

test.php looks like this:
<?
echo 'Inside first included file.';
if (file_exists('lib/test2.php'))
echo 'This file exists.';
include('lib/test2.php');
echo 'Ending first included file.';
?>

/www/lib/test2.php exists. Whenever I run this, I get the first two echo
statements, without getting the third one. The error log reports that it
couldn't find lib/test2.php. If I take out the 'lib/' in the include
statement, it works. According to the description from the manual, either
way should work. Has anyone ever come across this problem before, and is
there a config setting that causes it? I'm stumped here, and I refuse to go
change all the code when from what I've read it should already be working.

-- Rob

 

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

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