FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


File/Folder(s) Owner/Group





DanielXP
Hi when i use PHP to make a file or folder on my server it seems to set the owner/group as 99 instead of my username which it should be.

So when i try to delete these item, i can't.


Is there any way to fix this. i have done some reasearch and a few people have the same problem.
Diablosblizz
Are you talking about the file permissions? If so, then the chmod function will work just fine. Example:

Code:
chmod("/somedir/somefile", 0755);  // octal; correct value of mode


Must be octal though. Hope this helps.
DanielXP
Diablosblizz wrote:
Are you talking about the file permissions? If so, then the chmod function will work just fine. Example:

Code:
chmod("/somedir/somefile", 0755);  // octal; correct value of mode


Must be octal though. Hope this helps.


Nope.

I have tryed the chown function for this. Thats what should fix it but it don't
Diablosblizz
Sorry I couldn't have been more help, I don't understand what you mean.
Star Wars Fanatic
DanielXP wrote:
Hi when i use PHP to make a file or folder on my server it seems to set the owner/group as 99 instead of my username which it should be.

So when i try to delete these item, i can't.


Is there any way to fix this. i have done some reasearch and a few people have the same problem.


When you access the script in your browser, the server executes that script under a different username then your account username.
That is why you have trouble accessing it. I also had such trouble a while back when I was creating tons of image files through php, and then was unable to delete them because I didn't have permission >.<

You'll have to use a php script to change the ownership. If you have already tried chown, then go ahead and try chmod to change it. The script Diablosblizz posted will be fine:

Code:
chmod("/somedir/somefile", 0755);  // octal; correct value of mode


If the permissions 0755 doesn't work, then try the permissions 0777, which isn't very safe, but try it anyways, if it doesn't work then there is some other problem.

Let us know what happens!
rvec
*Rvec Loves having the answer Smile*
http://www.frihost.com/forums/vt-14867-2.html
last 3 posts Smile
DanielXP
Star Wars Fanatic wrote:
DanielXP wrote:
Hi when i use PHP to make a file or folder on my server it seems to set the owner/group as 99 instead of my username which it should be.

So when i try to delete these item, i can't.


Is there any way to fix this. i have done some reasearch and a few people have the same problem.


When you access the script in your browser, the server executes that script under a different username then your account username.
That is why you have trouble accessing it. I also had such trouble a while back when I was creating tons of image files through php, and then was unable to delete them because I didn't have permission >.<

You'll have to use a php script to change the ownership. If you have already tried chown, then go ahead and try chmod to change it. The script Diablosblizz posted will be fine:

Code:
chmod("/somedir/somefile", 0755);  // octal; correct value of mode


If the permissions 0755 doesn't work, then try the permissions 0777, which isn't very safe, but try it anyways, if it doesn't work then there is some other problem.

Let us know what happens!


Thanks i'll try that.


rvec wrote:
*Rvec Loves having the answer Smile*
http://www.frihost.com/forums/vt-14867-2.html
last 3 posts Smile


I don't have DirectAdmin im using Cpanel.
rvec
I don't think you can change the permissions because you don't have access. You could try the script in the first post of the topic I just posted.
DanielXP
Star Wars Fanatic wrote:
DanielXP wrote:
Hi when i use PHP to make a file or folder on my server it seems to set the owner/group as 99 instead of my username which it should be.

So when i try to delete these item, i can't.


Is there any way to fix this. i have done some reasearch and a few people have the same problem.


When you access the script in your browser, the server executes that script under a different username then your account username.
That is why you have trouble accessing it. I also had such trouble a while back when I was creating tons of image files through php, and then was unable to delete them because I didn't have permission >.<

You'll have to use a php script to change the ownership. If you have already tried chown, then go ahead and try chmod to change it. The script Diablosblizz posted will be fine:

Code:
chmod("/somedir/somefile", 0755);  // octal; correct value of mode


If the permissions 0755 doesn't work, then try the permissions 0777, which isn't very safe, but try it anyways, if it doesn't work then there is some other problem.

Let us know what happens!






I tryed this.

Code:
chmod($_SERVER["DOCUMENT_ROOT"] . $SITE[urlprefix] . "/sitedata/funny_pictures/" . $fpic[id] . "/thumb." . $fpic[iformat], 0755);
chgrp($_SERVER["DOCUMENT_ROOT"] . $SITE[urlprefix] . "/sitedata/funny_pictures/" . $fpic[id] . "/thumb." . $fpic[iformat], "arcade");
chown($_SERVER["DOCUMENT_ROOT"] . $SITE[urlprefix] . "/sitedata/funny_pictures/" . $fpic[id] . "/thumb." . $fpic[iformat], "arcade");


It chmods then but it leaves the images owner as '99' and impossible to delete.

Also it gives this error
Quote:
Warning: chgrp() [function.chgrp]: Operation not permitted in /home/arcade/public_html/V2.0/fixpics99.php on line 10

Warning: chown() [function.chown]: Operation not permitted in /home/arcade/public_html/V2.0/fixpics99.php on line 11
Stubru Freak
DanielXP wrote:
Star Wars Fanatic wrote:
DanielXP wrote:
Hi when i use PHP to make a file or folder on my server it seems to set the owner/group as 99 instead of my username which it should be.

So when i try to delete these item, i can't.


Is there any way to fix this. i have done some reasearch and a few people have the same problem.


When you access the script in your browser, the server executes that script under a different username then your account username.
That is why you have trouble accessing it. I also had such trouble a while back when I was creating tons of image files through php, and then was unable to delete them because I didn't have permission >.<

You'll have to use a php script to change the ownership. If you have already tried chown, then go ahead and try chmod to change it. The script Diablosblizz posted will be fine:

Code:
chmod("/somedir/somefile", 0755);  // octal; correct value of mode


If the permissions 0755 doesn't work, then try the permissions 0777, which isn't very safe, but try it anyways, if it doesn't work then there is some other problem.

Let us know what happens!






I tryed this.

Code:
chmod($_SERVER["DOCUMENT_ROOT"] . $SITE[urlprefix] . "/sitedata/funny_pictures/" . $fpic[id] . "/thumb." . $fpic[iformat], 0755);
chgrp($_SERVER["DOCUMENT_ROOT"] . $SITE[urlprefix] . "/sitedata/funny_pictures/" . $fpic[id] . "/thumb." . $fpic[iformat], "arcade");
chown($_SERVER["DOCUMENT_ROOT"] . $SITE[urlprefix] . "/sitedata/funny_pictures/" . $fpic[id] . "/thumb." . $fpic[iformat], "arcade");


It chmods then but it leaves the images owner as '99' and impossible to delete.

Also it gives this error
Quote:
Warning: chgrp() [function.chgrp]: Operation not permitted in /home/arcade/public_html/V2.0/fixpics99.php on line 10

Warning: chown() [function.chown]: Operation not permitted in /home/arcade/public_html/V2.0/fixpics99.php on line 11


Just chmod it to 777. It's not dangerous when you delete it immediately. Or delete the files using PHP.
rvec
You can't change the permissions if you don't have access. Use the script posted in the first post of this topic: http://www.frihost.com/forums/vt-14867.html
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.