Laravel artisan cache permission issues

I am using Laravel's file caching system (at least temporarily) to cache numerous smaller, mainly static objects from the database. However, if I use artisan to run some functions (which add/call from the cache) and then try to load a webpage, I get permission errors while trying to access the cache. Same error when done the other way around (view web page and then run artisan).

This is because the cache is owned by me when I run an artisan command, but is owned by apache when run through the webpage.

I have thought of 2 solutions. One, delete all the cache at the beginning and end of all artisan calls (not ideal, loses most of the performance boosts). Or, run all my artisan commands as the apache user (not convenient, and maybe not even possible).

Is there a way to modify the permissions automatically of Laravel's file caching? Or set artisan's caching to use the apache user maybe?

Answers


Not the most elegant solution, but I ended up just removing caching from my artisan commands. These were just background tasks that did not need the same speed boost as the front end does.


You can try to chmod the storage folder to 0777. You can do this using your command line.

$ chmod --help


Need Your Help

apache python error

python django apache mod-wsgi wsgi

I am getting this in my error log file. Ive been searching for asolution but have found nothing. I am trying to deploy django with mod_wsgi.

How to know if a webpage is fully loaded or not in java

java parsing loading

I am working with java to get some information from a web page.