Friday 11 May 2012

How to configure the writable directories in Symfony2' on Mac OS

I know it's my set-up, so please no comments (not like anyone except me reads this stuff anyway lol) but I can't be arsed to change it because it works for everything else I do. But every time I create a new Symfony2 project and run it for the first time I get errors like

[InvalidArgumentException]
The directory "/path/to/my/workspace/MyProject/app/cache/dev/annotations" is not writable.
PITA...

The answer's actually right there on the Symfony documentation, but if you can't be bothered to look for it (like me) or you somehow stumbled across this page first (doubt it) then the answer is as follows: Enter the follow commands but DON'T copy and paste... (see below)

rm -rf app/cache/*
rm -rf app/logs/*

sudo chmod +a "<name_of_your_http-server_user> 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

Replace "<name of your http-server user>" with the actual name of the user that runs the httpd server on your system.

And if you get stuck...

Assuming you've got the error message above, or similar at least, enter:

ls -al /app/cache/
And you'll be able to work out from there what user you should be entering above. If you can't... you're reading the wrong blog.

No comments:

Post a Comment

Please leave your feedback and comments. I love to discuss this stuff!