After entering the Global Configuration area on the site Administrator “back-end” and then clicking on either the “Save” or “Apply” button to save the current choice of site configuration, the following error message appears: “An Error has occurred! Unable to open configuration.php file to write!”, 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 and/or unable to make the file writeable (i.e. R/W). Since Joomla! 1.5.x attempts to make “configuration.php” writeable before saving the configuration, the latter is more usually the case. The most common reason for this is that the file “configuration.php” is owned by a different logical user to 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 as something like “apache” or “www-data”). (You can usually check on file ownership details by logging in to 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.
NOTE: it is not sufficient to just make the “configuration.php” file writeable for all users. As then you will be be able to update the Global Configuration only once, after which Joomla! 1.5.x will make the file read-only for all users and thus reintroduce the problem.
- 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”.
NOTE: This is not something that you can do within Joomla!.
If you have total control of the server (e.g. local server or virtual server) then you should be able to do this using an appropriate utility (such as “chown” for a Linux server). On a shared server, you should contact the technical support for your organisation or your ISP, explain the problem, and ask them change the file ownership appropriately.
- Install the eXtplorer component (obtainable from the Joomla! Extensions Directory – extensions.joomla.org) – 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).
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 in it 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 “Apply” 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 as something like “apache” or “www-data”).