This question has been asked several times but none of the solutions fix it in my situation.
I am running Apache on Mac OSX Lion. This http://localhost/Symfony/web/config.php
URL triggers 2 major problems:
Change the permissions of the "app/cache/" directory so that the web server can write into it.
Change the permissions of the "app/logs/" directory so that the web server can write into it.
Following the guide under "Setting up Permissions":
rm -rf app/cache/*
rm -rf app/logs/*
sudo chmod +a "_www allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
That doesn't solve the problems, so then I tried:
sudo chmod -R 777 app/cache
That doesn't work either. Any ideas how to fix this?
Some preliminary explanations:
app/cache
directory.app/logs
directory.Some words about Apache:
user
and a specific group
(usually www-data
for both, but you have to check your installation to find the used ones. For example, if you search in the /etc/apache2/envvars
in Linux, you will have two variables APACHE_RUN_USER=www-data
and APACHE_RUN_GROUP=www-data
).user
and group
.Analyze of your problems:
First of all you have errors like:
Change the permissions of the "app/cache/" directory so that the web server can write into it.
Change the permissions of the "app/logs/" directory so that the web server can write into it.
because your app/cache
and app/logs
folders are not writable for your Apache user
and group
.
Secondly, by executing:
sudo chmod +a "_www allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
you are modifying the Access Control List (ACL) of the app/cache
and app/logs
folders in order to grant some permissions to whoami
(basically you) and to _www
.
This approach does not work and can have two origins:
You are modifying ACLs, but are your kernel and your file system configured to take into account ACLs?
You are giving some permissions to whoami
and to _www
, but have you checked that your Apache instance runs under one of these users?
Thirdly your colleagues solve the problem by executing:
sudo chmod -R 777 app/cache
This approach works because of two reasons:
777
), so you are sure that at least your Apache user and group have also the needed permissions to write in app/cache
.-R
), so all the nested folders created in the app/cache
directory are also concerned by the new permissions.Simple solution:
Delete the content of your app/cache
and app/logs
folders:
rm -rf app/cache/*
rm -rf app/logs/*
Give all permissions (reads and writes) to your app/cache
and app/logs
folders:
chmod 777 app/cache
chmod 777 app/logs
Remarks:
The guide under the "Setting up permissions" says that if your system doesn't support chmod +a you have to do this:
HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
If that doesn't work try this:
umask(0002); // This will let the permissions be 0775
// or
umask(0000); // This will let the permissions be 0777
First solution worked for me. I hope it helps someone with the same type of issue.
rm -rf app/cache/*
rm -rf app/logs/*
APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1`
sudo setfacl -R -m u:$APACHEUSER:rwX -m u:`whoami`:rwX app/cache app/logs
sudo setfacl -dR -m u:$APACHEUSER:rwX -m u:`whoami`:rwX app/cache app/logs
Source:
http://symfony.com/doc/current/book/installation.html#configuration-and-setup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With