Re: Help with strange include problem in PHP 5.2.0

From: Date: Thu, 30 Nov 2006 18:04:40 +0000
Subject: Re: Help with strange include problem in PHP 5.2.0
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-245365@lists.php.net to get a copy of this message
On Thu, November 30, 2006 6:49 am, Markus Mayer wrote: > I have a strange problem including files in PHP 5.2.0 running on Unix. > If I > try to include a file using include 'filename.inc';, everything is > fine. As > soon as I try to put a "." in front of the file name, for example > include './filename.inc';, I get a "failed to open stream: No such > file or > directory" error. Does anyone have any suggestions as to what is > going > wrong?` This all works with php 4.4.4 built with the same environment > and > compiler on the same system. What is your include path in PHP 5.2.0? I'm going to go out on a limb and bet a dollar that the PHP 4.4.4 include_path has "." as one element within the list and that the PHP 5.2.0 include_path does NOT have "." within the list. I.e.: 4.4.4 include_path ".:include_test_dir" 5.2.0 include_path "include_test_dir" In the first case, 4.4.4, you've got . in there, so . combined with ./ will "find" the file you want. In the second case, 5.2.0, you've got no . in there, so ./ is looking in a directory, not the directory you expect, and it ain't finding the file because it's not there. Rant #24, not directed at Markus, but the world at large :-) PHP developers should understand and use include_path instead of hacking up their source with hard-coded paths and weird sub-directory / parent-directory hacks in include/require statements. It drives me nuts when I install nice software packages, but I can't put their components where I want them. End result: rm -rf [insert your nifty project directory name here] -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#245365) next »