Should we chmod files and folders we created with 777? ================================================================ When the script creates a file with file_put_contents, it will give permissons: rw_r__r__ www-data:www-data the first rw is the read and write permissions of www-data. So www-data can read, write the file. but auser can only read the file (if we use vi, gedit seems to be able to write, maybe becuase it sudos behind the scene ). ================================================================ When the script creates a folder with mkdir it will give permissons: rwxr_xr_x www-data:www-data auser can not delete the folder with nautilus. ================================================================ If the user account of the webserver and the user account of the FTP are different, then maybe doing chmod is better because it's easy to edit/delete files and folders with FTP account. Of course, chmod(777) isn't really secure though. ================================================================