|
Posted by Marcin on 06/26/06 12:40
> Now, you cd to /somedir/subdir and execute the script: all is fine.
> Next, you cd to /somedir and execute the script: it fails. Why?
>
> Because you include the text file relatively to the current working dir
> (cwd), PHP expects the text file to be in /somedir, simular to:
>
> readfile('/somedir/test.txt');
>
> And this is restricted, hence the error message. For this reason, using an
> absolute path works, because this doesn't take the cwd into account.
You are right, but problem isn't in it.
On my home's FreeBSD box evrything works ok, but
on Solaris 10 I have to use absolute path's.
Why do I have to do it ?
> To dynamically determine the absolute path, you could do something like:
> readfile(dirname($_SERVER['PHP_SELF']) .'/test.txt');
Thank you, I will use it :)
--
Marcin Kula
Navigation:
[Reply to this message]
|