NYCPHP Meetup

[nycphp-talk] Why can't I create a second directory?

Gary Mort bz-gmort at beezifies.com
Thu Aug 30 12:33:13 EDT 2007


Ajai Khattri wrote:
> On Thu, 30 Aug 2007, Gary Mort wrote:
>
>   
>> I set the mode to 777 just to make sure the directory would be created 
>> completely unsecured(I will also note that does not happen, instead the 
>> directory is created as 755 which should STILL be acceptable since the 
>> script itself is the one creating both directories and thus should be 
>> the owner).
>>     
>
> That's probably were you're wrong: more often than not, the script will be 
> running as the same user as the Apache process (after all, the Apache 
> process hands off to the PHP module). So the script is running as "nobody" 
> or "www" rather than the owner of the files.
>
>   

Not an issue in this case, since the script is creating both 
directories.  No matter what user it is running as, it will be the owner 
of the directories since it is the one creating the directories.

(though just to be on the safe side, I did rewrite my script to print 
out the uid the script was running under, and the uid of the directory 
and they matched.   I also realized the reason I was getting 755 was due 
to the umask, so I just changed the initial permissions to minimal and 
added a call to chmod - that worked - as far as setting permissions.  
The dang second directory still won't create.  Heck, I even put a 2 
second delay between creations just in case the OS was being flaky )

More and more, I find I am spoiled with my current web provider.  I 
never have these problems with them.  Given that not being an option, 
give me a system I can have root on and can setup things myself.



More information about the talk mailing list