note 26757 deleted from function.file-exists by sniper
| From: | sniper@php.net | Date: | Sun, 23 Nov 2003 01:28:09 +0000 |
| Subject: | note 26757 deleted from function.file-exists by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-60840@lists.php.net to get a copy of this message | ||
Note Submitter: tom@tom420.com
----
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 :)