Drupal automatically changes the directory permissions of sites/default to 555 (i.e. read-only), which means that if I'm editing sites/default/settings.php, even if I've set the permissions for that file to read/write (which it again reverts on a page load), PhpStorm still gives me a permission denied error on the swap file it's attempting to create in the same directory.

  • Is there a more flexible way to update settings (especially on a dev machine) other than manually setting the file and directory permissions every time you need to edit those files?
  • Do I just have to do it via sudo?
  • Can I disable permissions checking for a specific environment?

If you are on Drupal 8, you can configure settings.php to include a settings.local.php with a simple environment check (to ensure you are running a local env).

In that file, you can add this:

$settings['skip_permissions_hardening'] = TRUE;

This will allow you to open and write to settings.php without it being locked back down.

  • Thanks - I'll add that this is included in the default settings of example.settings.local.php – William Turrell Feb 5 '17 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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