Trying to edit settings.php via Cpanel File Manager

I can CHMOD the file to anything I want and back but can't write to it.

I get the following message:

Could not write /home/testing/public_html/sites/default/settings.php: Permission denied

Do you think Apache suEXEC has anything to do with this?

  • This is server side issue not Drupal related. You need to check permission for sites, default and settings.php file. – Jayendra Kainthola Nov 18 '13 at 4:59
  • 1
    settings.php is write-protected. You can change the permissions to make it writable, but Drupal will change it back on the first page load, and set it write-protected again. So you should make any change in the settings.php without visiting your site after changing the permissions. – Елин Й. Nov 18 '13 at 5:38
  • sites/default folder permission setting is 555, is that correct? What should it be? – Shane Houston Nov 18 '13 at 6:02
  • @ShaneHouston ask your sysadmin. Webserver that runs Drupal must be able to enter it and all it's subfolders, read everything there, and write & delete in files subfolder. How to set that up depends on your server's configuration. – Mołot Nov 18 '13 at 8:58
  • sites/defualt permission should be 755 – Mohammed Shameem Nov 18 '13 at 9:42

As others have mentioned, you must set the permissions on the /sites/default folder. The default permissions are set to 0555, set them to 0755 for editing. Don't forget to restore the default values afterwards!

  • Thanks, I had to set permission 755 on sites folder first, then the default and finally on the files in it in order to be able to delete it all. – Lumis Nov 19 '14 at 23:07

I will recommend to download the file on your local system if you can. Right click on the settings.php file and select Properties from the list. Uncheck the Read-only from Attributes. Click apply button and click OK. Make changes and upload the file back to the server.

NOTE: After editing the file Check the Read-only attribute before uploading.

enter image description here


You can edit the permissions of the folder it self. The folder "default" set to 0555, set them to 0755 for editing. Don't forget to restore the default values afterwards!

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.