I have been looking for what I need to see if it is already answered, but the only things I'm seeing is a link back to the php.net site to a page that makes no sense to me. Forgive me please, I don't claim to be a professional coder so a lot of it does not seem to percolate through my head lol. lets say I have a directory /home/account/public_html/myfolder/ which is set to 755, but I want to use a PHP script to set it to 0777. How do I do that in simple terms? Thanks.
<?php $dir = "/home/account/public_html/myfolder/"; if(is_dir($dir) && chmod($dir, 0777)){ echo "Done!"; } ?> PHP:
chmod('/home/account/public_html/myfolder/', 0777); PHP: Note that in most typical cases, this will only work if /myfolder/ was created by PHP in the first place. That's because chmod won't work unless it's being called by the owner of the file or folder in question. Normally the web server user is different from the user account used to upload files via FTP/SCP. Your mileage may vary.
Mmmmmmm ok. But what I was reading lead me to believe that the PHP chmod command only worked on files, not directories. I give it a try though. Guess I was even more confused than I thought. Thanks!