I have a folder above the web root that is used to temporarily store user files generated by the php web application. Files can be, for example, PDFs, which will be attached to emails.
Folder permissions are set to rwxr-xr-x (0755). When executing the procedure from the web application, the files are written to this folder without any problems.
Now I also created a cron job that calls a php script to execute the same procedure as above. However, the PDF cannot be saved to the above folder due to failed permissions - the cron job returns an error permission denied.
I tried to set the folder permissions on 0775 and still get access denied. However, when the permissions are 0777, then the cron job works fine.
This seems very strange to me - why does cron get permission rejected at 0755 but it works fine through a web application?
Jonob source
share