How to set chmod for a folder and all of its subfolders and files in PHP? -


this question has answer here:

i think question explains everything. want use php's chmod() function set 777 permission on folder, subfolders , files.

any appreciated. thx.

chmod("folder",0770); 

function in php allow change permission of file , recursive change use exec

exec ("find /path/to/folder -type d -exec chmod 0770 {} +");//for sub directory exec ("find /path/to/folder -type f -exec chmod 0644 {} +");//for files inside directory 

make sure webserver have write access folder.

check these more detail
http://php.net/manual/en/function.chmod.php
http://www.w3schools.com/php/func_filesystem_chmod.asp


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -