I've been working on a Drupal 8 site for a month or so now and development has been progressing nicely until a week ago. It looks like the issues started at just about the same time that the website host applied a server update. The first part of the issue is that I now have a WSOD with the error - The website encountered an unexpected error. Please try again later. I thought that issue might be related to the hosting environment as it's still running php5.6 (now no longer supported by version of Drupal from what I understand).
I thought that if I copied the site files and database to a different environment running php7.2 or 7.3 I might be able to resolve the issue. However since I don't have root access to the dev server I decided to export the database from the dev server as a sql.zip file and then import it into my new database on the new 'test' server and copy the site files across. However while performing the Drupal install I added a prefix for the 'test' database tables. I realised what I had done and went to the settings.php file to change it. When I tried to push the file up via FTP I got a 'failed to write file' error. Instead of trying to sort out the permission via FTP I logged into the Cpanel. I set the permissions of the sites folder to 755 and checked the box to apply the permissions to all sub-folders and files. I checked and all files permissions were updated. I open the settings.php file using the edit option in Cpanel and edited the line with the database prefix (to target the imported tables from the dev site -they have no prefix) to
'prefix' => '',
and clicked 'save changes' and I got the error
"The system failed to create the file “/home/user_account_name/public_html/sites/default/settings.php.lock” (as EUID: 1045, EGID: 1040 1040) because of the following error: Permission denied"
If I change the prefix value and edit anything else like the username I can then save the file without an issue.
Can someone please explain what is happening here. I believe that there is some flag set in the database (or another file) that is preventing me from updating and saving the settings.php and it may also be the reason for my WSOD issue.
Drupal version is 8.6.10 on dev server and 8.7.3 on the test server.