Php – Symfony No Access to Cache – Red Hat 7

amazon ec2cachePHPredhat

I'm running amazon EC2 VPC, normaly use Centos and I have no problem with it, but I have tried Red Hat Enterprise Linux Server release 7.1, and I have installed everything from scratch.

I'm using Symfony 2.7.5, and I really struggling with the cache.

The web application seams to not have access to the cache folder (app/cache)

RuntimeException in bootstrap.php.cache line 2671: Unable to create the cache directory (/var/www/mysite/app/cache/dev)

I have researched a lot and tried all, change ownership, give full accesss to the folder cache…

chown -R root:apache app/cache
chown -R root:apache app/logs

chmod -R 777 app/cache
chmod -R 777 app/logs

sudo setfacl -R -m u:apache:rwX -m u:ec2-user:rwX app/cache app/logs
sudo setfacl -dR -m u:apache:rwx -m u:ec2-user:rwx app/cache app/logs

In the command line I can use php app/console cache:clear and it works. I dont know if its a problem with this Symfony's version or its some kind configuration problem. Thanks for the help.

Best Answer

I faced the same problem and I fixed it by disabling SELinux in this file /etc/selinux/config I know it's not the best solution because SELinux allows additional security, but this helps to overpass the problem until you find the best one.

Related Topic