Re: PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5)
| From: | Rahul Sitaram Johari | Date: | Thu, 01 Nov 2007 16:09:30 +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-263929@lists.php.net to get a copy of this message | ||
On 11/1/07 10:41 AM, "Daniel Brown" <parasane@gmail.com> wrote:
> On 11/1/07, Rahul Sitaram Johari <sleepwalker@rahulsjohari.com> wrote:
>>> 1.) Did you restart Apache after making any changes to php.ini or
>>> httpd.conf?
>>> 2.) The path is cAsE-sEnSiTiVe. Did you make sure that it's
>>> EXACTLY the same?
>>> 3.) Is any part of that symlinked, and if so, does Apache allow
>>> FollowSymLinks?
>>> 4.) Is the account jailed or chroot'ed?
>>
>> 1) Checked!
>> 2) Checked!
>> 3) It is symlinked indeed!! Where in httpd.conf do I need to specify
>> FollowSymLinks? I'm running Apache 2.2.6 with PHP 5.2.4 on Mac OS X 10.5
>
> Bah! Sorry to give you false hope on that, Rahul. I re-read the
> post and my responses, and Apache would actually have nothing to do
> with this particular problem. In any case, in your httpd.conf file,
> you can enable FollowSymLinks near your AllowOverride directives. It
> won't help in this case, but that's where it resides, nonetheless.
>
> If you
su - to the user as which the PHP script is running,
> does
> that user have permission to access the Windows share? Are you
> running this from the CLI or the web (I just noticed in the email you
> just sent to Rob that it's a web error message).
>
> Try this:
>
> Take *just* that part of the script and run it from the CLI as
> yourself to see if you can "see" the file. If not, try it as root.
> If you can, then su - to the account under which Apache is
> daemonized. You may need to update /etc/passwd to allow a shell to be
> opened for that account.
>
> When running the simple script from the CLI as the web server
> account, can you see the file? Can you change to that directory?
>
> It may very well be that the account under which Apache runs is
> jailed/chroot'ed.
Well FollowSymLinks was present in my httpd.conf, and it's definitely not
the problem. I think the problem is the fact that on in Panther, I was able
to specify Apache Web Server to be the User/Group for the share being
mounted with -u 70 -g 70 during mount_smbfs.
In Leopard I'm not able to do that because they eliminated the -u -g
arguments for mount_smbfs - in fact they even eliminated NetInfo Manager so
I don't even know Apache's UID & GID.
So after mounting the share on the share point, this is what happens:
http://www.troyjobs.com/media/smb.gif (It's
a screenshot of difference
between Panther & Leopard on the same folder showing different User/Group).
As you can see files within the mounted share had "www" (Apache) as the user
& group and PHP didn't have any problems accessing the files. But in
Leopard, "www" (Apache) is not the user/group.
I don't know what you have to do in Leopard to mount a share giving it a
User/Group of your choice.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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²