pjozpq
Last Updated: February 25, 2016
·
2.476K
· ftassi

How to set proper Symfony2 cache/logs permissions on Mac OS

Script from https://github.com/everzet/dotfiles/blob/master/scripts/chcache

!/bin/sh

USER=$(whoami)
APACHE_USER=$(ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk 'END {print $1}')

chcache () {
sudo chmod +a "$USER allow delete,write,append,fileinherit,directoryinherit" $1
sudo chmod +a "$APACHEUSER allow delete,write,append,fileinherit,directory_inherit" $1

echo "- $1 has been properly chmod'ed for $USER and $APACHE_USER"

}

symfony 1.4

if [ -d cache ]; then chcache "cache"; fi
if [ -d logs ]; then chcache "logs"; fi

Symfony2

if [ -d app/cache ]; then chcache "app/cache"; fi
if [ -d app/logs ]; then chcache "app/logs"; fi
if [ -d web/uploads ]; then chcache "web/uploads"; fi
if [ -d web/media ]; then chcache "web/media"; fi