Re: [PHP] Chmod a Directory
You will have to loop through the directory recursively, running chmod() on every file there is! Regards, Samy abderrazzak nejeoui schrieb: Please how can i chmod a directory to 0777 i tried chmod ($myDirectory, 0777); but nothing happens thanks in advence Nejeoui -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chmod a Directory
abderrazzak nejeoui wrote: Please how can i chmod a directory to 0777 i tried chmod ($myDirectory, 0777); but nothing happens Check the return value. If it's false then it's failing for some reason., most likely because the user it's running as doesn't have permission to extend the permissions on that directory that far. Also make sure you read the notes here: http://php.net/chmod -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chmod a Directory
On 10/9/07, Stut [EMAIL PROTECTED] wrote: abderrazzak nejeoui wrote: Please how can i chmod a directory to 0777 i tried chmod ($myDirectory, 0777); but nothing happens Check the return value. If it's false then it's failing for some reason., most likely because the user it's running as doesn't have permission to extend the permissions on that directory that far. Also make sure you read the notes here: http://php.net/chmod -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Once again, Stut is most likely correct. Chances are the directory was created by someone other than as whom the script is being run. If you're server isn't configured to use phpSuExec, sticky bits, or a similar setup, then chances are that you created the directory as your user account (via FTP, SSH, a file manager, etc.), and are attempting to chmod() the directory as Apache's user (nobody, httpd, daemon, apache, etc.). If that's the case, your best bet is to remove the directory using the same medium with which you created it (if you can), and add the following above your chmod() line: ? $directory = myDirName; if(!is_dir($directory)) mkdir($directory); chmod($directory,0777); ? However, another point to keep in mind is that, if you do things correctly, you should never need a directory to be 0777 (everyone can read, write, and execute), as that's a serious potential security risk. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chmod a Directory
At 12:00 PM +0200 10/9/07, Samuel Vogel wrote: You will have to loop through the directory recursively, running chmod() on every file there is! Regards, Samy Isn't there a sticky bit thing (i.e., 1777) you can use to change the files inside a directory? I've never done it, but I remember reading about it. Daniel Brown posted a magnificent post about permissions one time, but I can't find it. Perhaps he would be so kind as to post it again? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chmod a Directory
On 10/9/07, tedd [EMAIL PROTECTED] wrote: At 12:00 PM +0200 10/9/07, Samuel Vogel wrote: You will have to loop through the directory recursively, running chmod() on every file there is! Regards, Samy Isn't there a sticky bit thing (i.e., 1777) you can use to change the files inside a directory? I've never done it, but I remember reading about it. Daniel Brown posted a magnificent post about permissions one time, but I can't find it. Perhaps he would be so kind as to post it again? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com Thanks, Tedd! I had to search for it, and wasn't having much luck, but GMANE has a copy of it, posted 18 May, 2007. http://article.gmane.org/gmane.comp.php.general/163539 -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php