2

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.

Community
  • 1
  • 1
manix
  • 14,537
  • 11
  • 70
  • 107
  • That sounds terribly annoying. Have you also tried ``php artisan dump-autoload``, and not just ``composer dump-autoload``? – Joel Hinz May 09 '14 at 18:20
  • In my desesperate moment I have changed native OS config files and at this moment the system can not start.. (I am publishing this from the mobile) – manix May 09 '14 at 18:29
  • Oh, damn... good luck with that. :/ – Joel Hinz May 09 '14 at 18:39
  • @JoelHinz, I came back since I followed [this bad idea](http://stackoverflow.com/a/22279001/1424329). Roll back and continue with this laravel problem. – manix May 09 '14 at 18:46

2 Answers2

7

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!

manix
  • 14,537
  • 11
  • 70
  • 107
  • 1
    Yay! Glad you found the problem! :) – Joel Hinz May 09 '14 at 19:40
  • It's time to drink a beer – manix May 09 '14 at 19:41
  • @Moak, I am not an Linux expert. In my case, my environment is a Fedora 20 linux distribution that comes with a security application/demon named "selinux". So, the command above is telling something like: "please selinux, lets apache webserver write content in my application folder" – manix Mar 24 '15 at 16:18
2

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.

Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204