Welcome to WebmasterWorld Guest from

Forum Moderators: bakedjake

Message Too Old, No Replies

Owner nobody 99 99 after files are manipulated through PHP

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

Full Member

10+ Year Member

joined:Dec 27, 2006
votes: 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?
3:49 pm on Oct 24, 2013 (gmt 0)

Senior Member from NL 

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 10, 2005
posts: 2955
votes: 35

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].
6:05 am on Oct 25, 2013 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member graeme_p is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 16, 2005
posts: 2994
votes: 201

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".

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members