chmod($assets_folder, '0777');
mkdir ("$assets_folder/$new_folder", 0777);
chmod($assets_folder, '0755');
Heres what I am trying to do: The default permission of the $assets_folder (with path) is 0755. This is so that noone can execute any malicious script from outside of my server. Whenever I want to create a new directory inside $assets_folder, I will just change the permission to 0777, make the directory ($new_folder) and then change the permission back to 0755
Two problems:
1) for the chmod, it gives me an error "chmod(): Operation not permitted in /path/index.php on line xx"
2) If I just take out the chmod parts, and chmod $assets_folder to 0777 and just use
mkdir ("$assets_folder/$new_folder", 0777);
, it does create a new folder, but the permission of that new folder is seen as 0755. Worse yet, I can not upload/move anything in that folder. Not even via FTP. So the new folder becomes virtually useless!
Does anyone have any idea how to fix those problems? Thanks in advance