twharmon
twharmon

Reputation: 4272

Symfony on Apache permission issues

I have made a lot of Symfony apps that work in production, but recently tried deploying one to Ubuntu 16 for the first time. var/logs/prod.log shows errors about not being able to find classes, so of course the app won't run.

I can "fix" this with chmod 777 /var/www/ -R, and everything starts working. Surely that's not safe... How can I fix this the right way?

Note: I am currently not logged in as a user but as root.

*EDIT The app will not run after chmod 777 /var/www/var -R to change permissions for chache and logs, but only if I change the permissions for all the folders of the entire app.

Upvotes: 0

Views: 1371

Answers (2)

Ralph Melhem
Ralph Melhem

Reputation: 757

Symfony has a section in the documentation for file permissions

Mainly you need to adjust the apache user permissions for logging, and as root you can easily do that. Just remember to ignore the logs + cache if you're using source control such as Github.

Upvotes: 0

Lesotto
Lesotto

Reputation: 84

You might try locating folders/files which are the problem and change ownership to www-data which is actually used by Apache.

For a whole directory with files recursively:

chown -R www-data:www-data [folder_path_and_name]

For a specific file:

chown www-data:www-data [file_path_and_name]

Upvotes: 2

Related Questions