Created
January 9, 2015 09:49
-
-
Save webdevotion/e9c04fab50ad0cae9748 to your computer and use it in GitHub Desktop.
Fixing cache and logs permissions in Symfony application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove existing folders with unnecessary | |
ϟ sudo rm -rf app/cache/* | |
ϟ sudo rm -rf app/logs/* | |
# get the current apache user | |
ϟ HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1` | |
ϟ echo $HTTPDUSER | |
# chmod the folders with the apache user and your current CLI user | |
ϟ sudo chmod +a "$HTTPDUSER 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 | |
# run the same command on other ( custom ) folders that need the same permissions | |
ϟ sudo chmod +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" web/logs/ | |
ϟ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" web/logs/ | |
# restart the server | |
ϟ sudo apachectl restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment