1

I have just upgraded from 4.3.8 to 4.7.15 on Drupal 7.50. Everything went well except the <drupal_root>sites/default/files/civicrm/templates_c directory is rebuilt with the wrong file permissions. The owner should be fclub, not www-data, I think. For example, if I delete this directory in order to solve cached template loading problems and reload the page, it rebuilds itself.

drwxr-sr-x 3 www-data www-data  4096 Jan 11 14:24 templates_c

If I change the owner manually to the correct owner, as all other files and directories, there is an error message about not being able to write to temp files in templates_c.

This seems to be the residual affect of something that is causing multiple problems, including possibly outgoing mail, scheduled jobs and showing the menu.

Edit: Here is what it looks like after upgrading on an exact copy/dev site:

drwxrwsr-x 3 fclub www-data 4096 Jan 8 21:30 templates_c

1
  • 2
    Congrats on the big upgrade :)
    – Coleman
    Commented Jan 12, 2017 at 3:59

2 Answers 2

2

Actually that looks good - your webserver user www-data needs to be able to write to files/ (and anything below it);

2
  • That is the name of the group. The owner for everything else, including on my dev site is fclub. Perhaps the problems I'm having are unrelated.
    – Christia
    Commented Jan 11, 2017 at 15:26
  • Make the www-data user and group the owner of your var/www/drupal/sites/default/files (or equivalent) Commented Jan 11, 2017 at 18:18
0

If you getting the error: Uncaught PHP Exception Unable to write to the .../files/civicrm/templates_c" directory.

You have probably used drush cache clear run under your account and that created the temp files owned by the user running drush. SO you can "run drush as the web server user"

sudo -u apache drush cr

or you can just look at the location [/files/civicrm/templates_c] and after you find the "civicrm" folder at the top, just change ownership so web server can read & write that location (cached files).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.