# Modifying settings.php

**URL:** <https://forum.infinityfree.com/t/modifying-settings-php/94198>\
**Category:** Hosting Support\
**Created:** [May 30, 2024, 9:31am UTC](https://forum.infinityfree.com/t/modifying-settings-php/94198 "2024-05-30T09:31:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LatinBrass](https://forum.infinityfree.com/letter_avatar/latinbrass/32/6_22734026db12803ebb3e059622ac3534.png) [@LatinBrass](https://forum.infinityfree.com/u/LatinBrass)\
**Post date:** [May 30, 2024, 9:31am UTC](https://forum.infinityfree.com/t/modifying-settings-php/94198/1 "2024-05-30T09:31:59Z")

</div>

I’ve a site that needs to edit setting.php, I know what must I do, but I could not save the changes due to permissions.  
How Can I modify the settings.php in my website?  
Could anyone help me?

Thanks.

---

<div class="post-metadata">

**Author:** ![Meishin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/meishin/32/59902_2.png) [@Meishin](https://forum.infinityfree.com/u/Meishin)\
**Post date:** [May 30, 2024, 10:09am UTC](https://forum.infinityfree.com/t/modifying-settings-php/94198/2 "2024-05-30T10:09:08Z")

</div>

It’s your website. We know nothing about it, so is the `settings.php` you are talking. And no, there aren’t permission issues unless you are trying to write that outside of `htdocs`.

> [@Why are my files deleted after uploading them](https://forum.infinityfree.com/t/why-are-my-files-deleted-after-uploading-them/49310):
>
> Sometimes, when you upload a file, the upload is completed but the file is deleted immediately afterwards. This is usually caused by one of the following issues: The file is not in a htdocs folder All websites files must be uploaded to either the main htdocs folder, or to the domain specific htdocs folder (like example.com/htdocs). You cannot upload files to other directories on your account. If you try to create or upload files anywhere else, they will be deleted automatically. The file type…

And if you are using the online file manager, good luck. Use desktop FTP instead.

> [@How to upload files with FTP](https://forum.infinityfree.com/t/how-to-upload-files-with-ftp/49306):
>
> The best and most reliable way to upload files is to use FTP. To upload files with FTP, you will need to following: Your FTP username Your FTP password The FTP hostname An FTP client You can find your FTP username, password and hostname in the client area under the FTP Details section. The FTP password is the same as your hosting account and control panel password, which is different from the password for the client area. If you like videos better then text guides, you can find one at the bot…

---

<div class="post-metadata">

**Author:** ![LatinBrass](https://forum.infinityfree.com/letter_avatar/latinbrass/32/6_22734026db12803ebb3e059622ac3534.png) [@LatinBrass](https://forum.infinityfree.com/u/LatinBrass)\
**Post date:** [May 30, 2024, 11:11am UTC](https://forum.infinityfree.com/t/modifying-settings-php/94198/3 "2024-05-30T11:11:02Z")

</div>

Hi @Meishin:  
Thanks for your quick and kind answer.  
I do not mean that there’s is a permission issue. I mean that I could not change the permission of my own files (Drupal installation, via Softacolous).  
I’ve a drupal Site, and need to modify the settings.php in /sites/default, it could not be in other place.  
I’ve tried with online file manager, and let me change the file, but not save it.  
And also I’ve tried to deleted and upload a new file, via FTP (FileZilla), but I could not do anyone of both.  
How the rest of the users with drupal manage it?  
Thanks for your help and time.

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [May 30, 2024, 3:58pm UTC](https://forum.infinityfree.com/t/modifying-settings-php/94198/4 "2024-05-30T15:58:50Z")

</div>

I think I see the issue.

Drupal edits the permissions of the settings.php to make it not writable. This is usually considered to be a good security measure, as it helps to protect your settings.php file against hacks. However, because we run PHP as your own user, it means that if Drupal cannot write the file, then _nobody can write the file_. Including you. And if you change the permissions of your files so you cannot write them anymore, then you cannot make any changes to it in any way.

For this very reason we removed most CHMOD features, but it appears that it’s still possible to lock yourself out of your own file using PHP code. I’ll submit a request upstream to see if that can be corrected so this won’t happen again on new sites.

But there is nothing that can be done sadly to regain write control over your own file.

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [June 6, 2024, 3:59pm UTC](https://forum.infinityfree.com/t/modifying-settings-php/94198/5 "2024-06-06T15:59:20Z")

</div>

Closed on June 6, 2024, 3:59pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
