Php script user id
Moderator: General Moderators
Php script user id
I realized the ownership of the files php creates is not the same as the webhost user id.
For example if my webhost user id is clientx, the user id of files created by php is 99. The result of this is that i dont have access to the files php created through ftp.
I would like to know if there is any way php can work with webhost user id isntead of using its own id.
Thank you.
For example if my webhost user id is clientx, the user id of files created by php is 99. The result of this is that i dont have access to the files php created through ftp.
I would like to know if there is any way php can work with webhost user id isntead of using its own id.
Thank you.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
it has nothing to do with chmod permissions, on linux each file has its owner attributes, for example see this list:
drwxrwxrwx___93__32136___clientx____4096 Feb 12 13:36 .
drwxr-x---____14__32136____99_______8192 Feb 14 13:08 ..
-rw-r--r--_____1___32136___clientx____21 May 5 2004 .htaccess
drwx---r-x____2____99_______99_______4096 Nov 17 07:37 Akashi
drwx---r-x____2____99_______99_______4096 Feb 6 20:14 Andrea
Like you can see the files belong to different owners (clientx and 99), the files with owner attribute 99 are the files/directories created by php.
drwxrwxrwx___93__32136___clientx____4096 Feb 12 13:36 .
drwxr-x---____14__32136____99_______8192 Feb 14 13:08 ..
-rw-r--r--_____1___32136___clientx____21 May 5 2004 .htaccess
drwx---r-x____2____99_______99_______4096 Nov 17 07:37 Akashi
drwx---r-x____2____99_______99_______4096 Feb 6 20:14 Andrea
Like you can see the files belong to different owners (clientx and 99), the files with owner attribute 99 are the files/directories created by php.
Last edited by Endimion on Fri Feb 18, 2005 10:15 am, edited 1 time in total.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
I've happened across this before - he means php generated files (depending on any chmod setting) are under a different owner than the the user associated with his ftp account. i.e. Once PHP creates a file, he cannot ftp into the directory and modify/delete those files.
What you can do is a) check the user associated with php, and the user associated with your ftp account are in the same group - if possible. And ensure files created by PHP have group write permissions.
What you can do is a) check the user associated with php, and the user associated with your ftp account are in the same group - if possible. And ensure files created by PHP have group write permissions.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
php is being run under the apache user, 'nobody' in your case. Changing the owner of php.ini shouldn't do a thing other than potentially making php use defaults for all settings, which doesn't help you.
Having PHP change the owner, or permissions on the files is the correct action, unless you want to change the user php runs under..
Having PHP change the owner, or permissions on the files is the correct action, unless you want to change the user php runs under..
Its not possible for php changing the owner:
Warning: chown(): Operation not permitted in [path] on line 5
on php.net site it says on chown section:
Only the superuser may change the owner of a file.
Guess im not a superuser lol :p
Well, guess it must remain like that, once i asked the server administrator to change the permission because cpanel was displaying a wrong disk usage and the files became inaccessive through web and they had to reset it like it was before.
Anyways, thank you all for helping me
Warning: chown(): Operation not permitted in [path] on line 5
on php.net site it says on chown section:
Only the superuser may change the owner of a file.
Guess im not a superuser lol :p
Well, guess it must remain like that, once i asked the server administrator to change the permission because cpanel was displaying a wrong disk usage and the files became inaccessive through web and they had to reset it like it was before.
Anyways, thank you all for helping me