homepage Welcome to WebmasterWorld Guest from 54.211.201.65
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Owner nobody 99 99 after files are manipulated through PHP
rowtc2




msg:4618823
 2:19 pm on Oct 24, 2013 (gmt 0)

I didn't found on Google how to solve this issue, maybe someone may help me.


I have a dedicated server where i host a few sites. On all of them i face this problem.

When i copy image files from one folder to another or when i resize images via PHP script, the new images has owner nobody (99 99) and i cannot overwrite them when i run again the script.

When i upload images via FTP the owner for images is correct.
Owner/Group 526 522


After i resize or copy images in another folder via PHP script i have this owner:
Owner/Group 99 99


I have read the problem is that PHP and FTP are not in the same group.


What i need to do to have Owner/Group 526 522 after image resize or copy?

 

lammert




msg:4618835
 3:49 pm on Oct 24, 2013 (gmt 0)

You can change the owner of the new file in PHP with the chown() function. More information can be found in the PHP documentation [php.net].

graeme_p




msg:4618945
 6:05 am on Oct 25, 2013 (gmt 0)

Yes, it is usual for PHP (or Apache if you are using mod_php) to run as "nobody" to limit its access to the file system to reduce the damage that can be done if the server is hacked.

You can configure PHP/Apache to run as a different user, but if you run it as a user that has write access to your .php files or anything important, you are giving up a layer of security. If you run PHP as fastcgi rather than mod_php, it can be a different user from Apache.

I do not think chown() is going to work because it requires PHP to be running as root, which is a really bad idea.

The right solution is probably to configure things so that it is OK for files written by PHP to belong to "nobody".

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved