Re: PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
| From: | Rahul Sitaram Johari | Date: | Thu, 01 Nov 2007 14:29:10 +0000 |
| Subject: | Re: PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263919@lists.php.net to get a copy of this message | ||
On 11/1/07 9:46 AM, "Robert Cummings" <robert@interjinn.com> wrote:
> On Thu, 2007-11-01 at 09:06 -0400, Rahul Sitaram Johari wrote:
>> Ave,
>>
>> Somehow my PHP won't access, won't even acknowledge the existence of a file
>> that is outside the /Library/WebServer/Documents folder. This was never a a
>> problem before in any Mac version - it just started with Leopard.
>>
>> I don't know what has changed where, in httpd.conf or php.ini or somewhere
>> else, but something changed that's crippling access to files outside of the
>> webserver.
>>
>> This Works in Mac OS X 10.3.9 (i.e., prints File Exists) but the same exact
>> script does not work in Mac OS X 10.5, and yes, the file is available in
>> Leopard in the mentioned location - path is exact same - permissions are all
>> set:
>>
>> $filename = "/Users/username/Documents/Transfers/test.txt";
>> if (file_exists($filename)) {
>> echo "The file $filename exists<br><br>";
>> } else {
>> echo "The file $filename does not exist<br><br>";
>> }
>>
>> I¹ve already checked safe_mode which is Off and open_basedir which is not
>> set same settings as php.ini from before.
>> Any ideas what might be causing this?
>
> Have you checked phpinfo() to check that the php.ini being loaded is the
> one you think is being loaded? Also, are you get any warnings or
> notices?
Yes. Checked phpinfo() ... Correct php.ini loaded.
On fopen(), I get the following warning:
Warning: fopen(/Library/WebServer/Documents/Misc/osm/ox.txt)
[function.fopen]: failed to open stream: Permission denied in
/Library/WebServer/Documents/Misc/test.php on line 5
I was using if/else before with file_exists() or is_readable() and it didn't
give me any warnings or notices. Now I tried with fopen() and it does indeed
give me a warning.
One thing I must point out is that "osm" is a Share Point which has a
windows network share mounted on it (via SMB).
I'm not sure where the problems are in permissions, because while mounting,
I'm allowing full read/write permissions to share:
Mount_smbfs -f 777 -d 777 //user:pwd@ip/share sharePoint
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.
W: http://www.rahulsjohari.com
E: sleepwalker@rahulsjohari.com
³I morti non sono piu soli ... The dead are no longer lonely²