Re: can't open file
| From: | Richard Lynch | Date: | Fri, 13 Jul 2007 06:39:44 +0000 |
| Subject: | Re: can't open file | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-258759@lists.php.net to get a copy of this message | ||
On Thu, July 12, 2007 11:30 am, Anugrah Widya wrote:
> Stut wrote:
>> Anugrah Widya wrote:
>>> dear php developer,
>>>
>>> i have weird situation here, i can't create a file in 777 mode
>>> directory and stay in same server, is this a bug ??
>>>
>>> fyi. i'm using fc6, and php 5.1.6
>>
>> I'm not sure I understand what the problem is. Please post the code
>> you're using and a more detailed description of what you're trying
>> to
>> achieve and what's actually happening.
>>
>> -Stut
>>
> here the situation is, i have two domain (two website), and both stay
> in
> same server, and use same php
>
> Website A -> /var/www/html/A
> Website B -> /var/www/html/B
>
> website A would like to create some file in website B, in
> /var/www/html/B/var/tmp/queue, and that map is in 777 mode created by
> script
>
> what i got is the fopen() won't succeed to create the file in website
> B
>
> but if i test to write into /var/www/html/A/var/tmp/queue in website A
> admin it succeed
>
> is it because of some configuration in php.ini i didn't activate or
> what ??
If it's not safe_mode as Stut suggests, it's also possible that the
PHP user (probably Apache User) does not have permission to write into
/var/www/html/B/var/tmp/queue, regardless of whether you are in A or
B.
It's also remotely possible that your server is running two (or more)
pools of Apache servers, one for each of A and B (and others) and A
can write to A dir and B can write to B dir, because each is running
as a different user.
Or, you could be using php_suexec or fast cgi to achieve a similar
effect...
Basically, this is going to boil down to:
PHP us running as User X.
User X does not have permission to write to dir B.
The permission could be foiled by PHP with safe_mode, or could be
built into the permissions on the directories with chmod.
So if it's not safe_mode, mess around with "ls -als" on the directory,
and use phpinfo() or http://php.net/get_current_user
to figure out who
you are, and then it should be pretty clear who can/can't write to
that directory and why it's not working.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?