Re: __sleep() strange behavior with file writting and SESSION using
| From: | Jochem Maas | Date: | Wed, 21 Nov 2007 00:00:16 +0000 |
| Subject: | Re: __sleep() strange behavior with file writting and SESSION using | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-264885@lists.php.net to get a copy of this message | ||
Andrés Robinet wrote:
>> -----Original Message-----
...
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Just wanted to add, I found a log.txt at "D:\xampp\apache" which happens to
> be the root of the apache installation on my system... so, moral of the
> story, the current dir is not always the script's dir.
> dirname(__FILE__)."/log.txt" will do the trick.
I was stumped when originally reading your question. I guess I glossed
over the fact that you weren't using an absolute path for the log file.
the problem makes sense - the CWD is the directory of the script that was called,
but during the startup/shutdown phases of php there is no script, the CWD is then
whatever the CWD is of the process that started php - apache in this case. additionally
some code may change the CWD and there maybe countless of other factors that could effect
it.
I suggest always using absolute paths - of only to avoid little mind-benders like this.
:-)
>
> Rob
>