curuba
curuba

Reputation: 577

Permissions issue for Symfony on Centos vm

Good evening. I thought I wuold never have to ask this question... but I have no idea where to look anymore.

Here is the issue.

I installed Symfony on a brand new Centos 7 vm running in hyper v.

My apache user is apache. My app/cache and app/logs directory are owned by apache user and apache group. I have even set permissions of these 2 folders and subfolders to 777.

But still Symfony can't write in cache nor logs.

How is this possible? I would love to have some directions with this issue.

Thanks

Upvotes: 4

Views: 1850

Answers (5)

Libor
Libor

Reputation: 54

In CentOS you must log as root a write this:

sudo chcon -t httpd_sys_rw_content_t .../cache -R
sudo chcon -t httpd_sys_rw_content_t .../logs -R

Upvotes: 4

yfet
yfet

Reputation: 69

Try to disable selinux : [https://www.centos.org/docs/5/html/5.1/Deployment_Guide/sec-sel-enable-disable.html][1]. That solve my problem.

1- Open /etc/sysconfig/selinux and modify the value of SELINUX from permissive (or enforcing) to disabled

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=permissive
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0

2- Restart your computer and test.

Upvotes: 1

mangelsnc
mangelsnc

Reputation: 148

For me, this is the best way to set up permissions:

http://symfony.es/documentacion/como-solucionar-el-problema-de-los-permisos-de-symfony2/

Always work for me.

The link is in spanish, but I'm sure you can understand it watching the commands (if not speak spanish).

Upvotes: 0

curuba
curuba

Reputation: 577

It's not really a solution but more a workaround. I have replaced the centos vm by ubuntu and now everything runs smoothly just be ensuring the folders are owned by apache user. It is really a mystery to me. And I realise that I had never deployed a symfony application on centos before. I am sure there should be an explaination but obviously not that easy to find.

Thanks all for your help.

Upvotes: -1

Benoit W
Benoit W

Reputation: 79

Have a look at the "Setting permissions" section in http://symfony.com/doc/current/book/installation.html

Upvotes: -1

Related Questions