Cannot save Global Configuration changes
From Joomla! Documentation
After entering the Global Configuration area on the site Administrator "back-end" and then clicking on either the Save or Save&Close button to save the current choice of site configuration, the following error message appears: "An Error has occurred! Could not write to the configuration.php file!" possibly accompanied by "JFTP::write: Bad response" if you are working in FTP enabled mode.
Reason for this error
The configuration update script in Joomla! has been unable to change the contents of the file configuration.php to reflect any changes you made on the Global Configuration page. Joomla! has either been unable to write to the file or unable to make the file writeable (i.e. R/W). Since Joomla! 1.5.x attempts to make configuration.php writeable occur before saving the configuration, the latter is more usually the case.
The most common reason for this is that the configuration.php file is owned by a different logical user than the one trying to make the change. If you are trying to change Global Configuration with FTP enabled, the latter will usually be your FTP login ID; with FTP disabled it will be a web server process identity (often named apache or www-data).
(You can usually check on file ownership by logging into your site with an FTP program. Alternatively you could use eXtplorer – see below). Unfortunately, you will be locked out of changing to the appropriate mode to update the Global Configuration as the enabling and disabling of FTP mode (and thus changing the logical identity attempting to change the configuration) is determined by the Global Configuration data held in that file.
Change the ownership of the configuration.php file to match either your FTP login ID if using "FTP enabled" for the site, or the web server process identity if you are using "FTP disabled".
On a shared server, you should contact the technical support for your organisation or your web hosting provider, explain the problem, and ask them change the file ownership appropriately.
Use an Extension
Install the eXtplorer component (obtainable from the Joomla! Extensions Directory - Category File Management) – if not already in place. This will allow you to view and manipulate files in both "file" mode (using the web server process user identity) or "ftp" mode using your FTP login user identity. Although you will probably not be able to change the file ownership with this tool, you can use one of the modes to make configuration.php writeable for all users. This will enable you to change to the Global Configuration once – or more if you include in that a change to the FTP mode so that it matches the ownership of your configuration.php file (but see Note below).
NOTE: Changing the FTP mode will affect the ownership applied to files uploaded to the site under the new setting (e.g. when installing extensions). File ownership advice from ianmac
Check PHP Ownership
Get your web server to run PHP as CGI or FastCGI. This ensures that the PHP code is executed using the same user ID as used when uploading the Joomla code using FTP. Thus there is no conflict as the ID of the PHP process changing configuration.php file is the same as the file's owner. If you do not know how to set CGI or Fast CGI, contact your server administrator or hosting service provider for advice.
The above is a simplified explanation, but the following may be of interest and value to all, and also help expert users formulate their own solution to this problem.
- The file configuration.php is generated automatically in the site’s root folder (from configuration.php-dist) during site installation and incorporates the site-specific information given during the install process. Changes made in the Global Configuration area in the site's administrative "back-end" are written to configuration.php when the either the Save or Save&Close button is used.
- Whenever Joomla! attempts to update configuration.php file it first attempts to make it writeable, and after updating the file make it unwriteable (i.e. read-only) as a security precaution.
- Files on the web server hosting your Joomla! site will be owned by one of several entities, depending on how they were placed or created on the server. Generally files on a Joomla! site will be owned by either of two user identities:
- Files you upload by FTP or installed with FTP mode active will generally be allocated ownership of a user ID corresponding to your FTP login ID for that site,
- Files installed from within Joomla! and with FTP mode inactive will generally be allocated ownership by the “phantom” user ID that used to run the main web server processes as well as your Joomla! scripts (often named apache or www-data).