soned Posted June 28, 2007 Posted June 28, 2007 hi i get that error when i do a test chmod on a folder. how to i make it work? here is the phpinfo: http://eubankers.net/phpinfo.php ty! Quote
carbonize Posted June 28, 2007 Posted June 28, 2007 Do you have the correct permissions set on the folder containing the folder you are trying to chmod? Quote
soned Posted June 28, 2007 Author Posted June 28, 2007 hi! i set the folder where the script is running to 777 but i still get that warning Quote
carbonize Posted June 28, 2007 Posted June 28, 2007 And is the folder you are trying to chmod contained within the folder you have set to 777 ? Quote
soned Posted June 28, 2007 Author Posted June 28, 2007 yes it is.. basically, i did a test by doing: /public_html/testfolder/ I chmod public_html to 777 and the test script is inside it with this: <? chown("testfolder/", nobody); chmod("testfolder/",777); ?> you can see here http://eubankers.net/test.php Quote
carbonize Posted June 28, 2007 Posted June 28, 2007 (edited) Yes but PHP can not chmod testfolder unless public_html is chmodded to 777. try ><? if (@chown("testfolder/", nobody)) echo 'Owner changed<br>'; else echo 'Failed to change owner<br>'; if (@chmod("testfolder/",777)) echo 'Folder permissions changed'; else echo 'Failed to change permissions'; ?> Edited June 28, 2007 by carbonize Quote
soned Posted June 28, 2007 Author Posted June 28, 2007 done. i did chmod 777 the public_html folder lrwxrwxrwx 1 0 0 11 May 12 02:53 www -> public_html same problem: Failed to change owner Failed to change permissions ty Quote
soned Posted June 28, 2007 Author Posted June 28, 2007 it ried full path, same problem: <? if (@chown("/home/eubfnco/public_html/testfolder/", nobody)) echo 'Owner changed<br>'; else echo 'Failed to change owner<br>'; if (@chmod("/home/eubfnco/public_html/testfolder/",777)) echo 'Folder permissions changed'; else echo 'Failed to change permissions'; ?> Quote
carbonize Posted June 28, 2007 Posted June 28, 2007 (edited) Try it on a folder within testfolder. Failing that have a look at php.net/chmod where someone has posted the code to do it by FTP. Edited June 28, 2007 by carbonize Quote
soned Posted June 28, 2007 Author Posted June 28, 2007 thanks carbonize, but same problem. i also set the folder to 777 . i'll just open a ticket about this. ty Quote
soned Posted June 28, 2007 Author Posted June 28, 2007 hi got a reply from support: The files/folders you are trying to perform chmod/chown should be under the ownership of Apache (nobody). thanks to tina. hmm so my problem now is that i'll need to first chown the folder to nobody from ssh before i can chmod it. or.. i'll need to have php create the folder first so that it owns it and then i can chmod it. ty Quote
MikeJ Posted June 28, 2007 Posted June 28, 2007 You can't "chown" as a regular user. If you want existing files to have ownership of nobody, you will have to submit a helpdesk ticket. Also, just a word of caution, having public_html with 777 permissions is not a wise idea for security reasons. Any compromise on your site at all, and they can change anything within your website. If you only need to have your script be able to write to "testfolder" you can set testfolder to 777 and leave public_html as 755. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.