note 26757 added to function.file-exists
| From: | tom at tom420 dot com | Date: | Mon, 11 Nov 2002 22:14:12 +0000 |
| Subject: | note 26757 added to function.file-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39324@lists.php.net to get a copy of this message | ||
My previous post about a problem with file_exists() generated some reactions. Actually I received
several e-mails from people who got the same problem and wanted to know how I fixed it.
With further experimenting, I found that the problem is not related with PHP 4.2.3, but with Apache
2. file_exists() works as expected with PHP 4.2.3 under Apache 1.3.
As my previous post says, I used getcwd() to fix the problem. With some testing I found that under
Apache 2 file_exists (and several other similar functions) will only work on absolute paths, so I
formed absolute paths out of my relative ones.
Example:
Original code:
file_exists ("somedir/somefile.php"); // Always returns false
Modified code:
file_exists (getcwd()."/somedir/somefile.php"); // Works as expected
That said, I knew PHP under Apache 2 was only experimental but I originally though it would work
better, but I found just too much problem with that configuration to be usefull. Furthermore, some
of the Apache and PHP modules I needed wasn't working fine or not at all with Apache 2. So I
stopped experimenting further with Apache 2 and went back to Apache 1.3. The problem is not with
Apache 2 itself (I found it to be a good software) but from the fact that it is not yet enough
widely supported, including PHP which development for Apache 2 isn't complete.
You are free to contact me for other comments about this, but please do not ask me about how I fixed
that anymore, my only solution is the one above.
Tom :)
--
http://www.php.net/manual/en/function.file-exists.php
http://master.php.net/manage/user-notes.php?action=edit+26757
http://master.php.net/manage/user-notes.php?action=delete+26757
http://master.php.net/manage/user-notes.php?action=reject+26757