Question

Well, this error is so know but in my case I could not mitigate it in my side. I have migrated a laravel-4 installation to another server and for the first time accessed I get this error:

file_put_contents(/var/www/html/MyApp/app/storage/meta/services.json): failed to open stream: Permission denied

I have followed different googled aswers as below

However, any of them could not fix my problem. I also tried cleaning the cache and dump autoclass command:

php artisan cache:clear
chmod -R 777 app/storage
composer dump-autoload

Also, I have thought that the webserver process might be considered in the problem, so I seek for its user like this:

$ ps -ef|grep httpd

apache   11978 11976  0 11:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

Then, I added apache to the directory group owner and the problems persists.

I do not know what else to do, I am going insane because dancing naked under full moon neither fixed the problem.

Was it helpful?

Solution

I have discovered the cause of this problem. Looks like selinux does not allow to httpd service (apache web server) write in my app folder. So, I did:

setsebool -P httpd_unified 1 

Now everthing is working fine!

OTHER TIPS

Happens to me some times, but I just delete it and Laravel recreates it. As far as I know, this is just a cache list of services and can be safely removed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top