Reputation: 21
I am trying to deploy my symfony 3.4 application into a production environment and after all configuration this error occurs when I access the index page:
[Thu Aug 30 15:46:27.245613 2018] [php7:error] [pid 1748] PHP Fatal error: Uncaught RuntimeException: Unable to write in the cache directory ([...]/app/cache/prod)
in [...]/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:755
Stack trace:
#0 [...]/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(633): Symfony\\Component\\HttpKernel\\Kernel->buildContainer()
#1 [...]/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(137): Symfony\\Component\\HttpKernel\\Kernel->initializeContainer()
#2 [...]/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(197): Symfony\\Component\\HttpKernel\\Kernel->boot()
#3 [...]/web/app.php(14): Symfony\\Component\\HttpKernel\\Kernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))
#4 {main}
thrown in [...]/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php on line 755
The app/cache and app/logs directories have the right permissions and they own to the "apache" user (Centos 7 server).
So, I don't know what I am doing wrong. What could be the solution?
Upvotes: 1
Views: 3312
Reputation: 441
Yes. This solution is working fine.
Procedure:
Open the SELinux configuration file: /etc/selinux/config
Locate the following line:
SELINUX=enforcing
Change the value to disabled:
SELINUX=disabled
Save your changes and close the file. On the next reboot, SELinux is permanently disabled.
Note: Instead of disabling SELinux, you can also set permissive
attribute. This will helps you to print warnings instead of enforcing
.
Command:
SELINUX=permissive
To dynamically disable it before the reboot, run the following command:
# setenforce 0
Upvotes: 0
Reputation: 21
Thanks for your response MoxGeek. After many headaches I SOLVED it. The problem was not in the permissions but in the server configuration. I created a Centos 7 server instance with SELinux, so the problem was there.
The solution is just to disable SELinux. No more problems after that! Thanks a lot.
Upvotes: 1
Reputation: 458
do you gives the right permission to your app/cache and app/logs ? also don't forget to clear cache
Upvotes: 0