WordPress File Permission and FTP info Issue

As your business grows or when your current hosting provider’s service quality deteriorates, you have no other option than to move to a hosting account but the process of transferring can be taxing and it some times creates weird issues like this one..

When I moved from hostgator to Knownhost, all of my websites started reporting errors like:-

  • 1. I could not upload images from WordPress admin/dashboard.
  • 2. Several plugins like W3totalcache and several others stopped working and reporting the following error:

The settings could not be saved because the config file is not write-able. Please run chmod 777  ../wp-content/w3-total-cache-config.php to resolve this issue.

  • 3. I could not add plugins, themes or update plugins or update wordpress from WordPress dashboard directly as it kept asking for FTP or connection information.

When I contacted support, they suggested changing file permissions to 777 to fix the 1st 2 errors. And for 2nd error they suggested giving 644 permission to wp-config.php file and entering following permission to it:-

define(“FTP_HOST”, “domain.com”);
define(“FTP_USER”, “ftpusername”);
define(“FTP_PASS”, “ftppassword”);

However, I was not comfortable using these settings as they pose security risk. So, I researched the web and found a few possible solutions:-

1. Installing SuPHP could resolve all of these issues. I contacted support but they rejected the idea claiming that it was equally un-safe.

2. Make sure that the scripts which need to write to the filesystem are owned by the same user that apache is running as. This advise also did not go well with hostoing support as it seemed un-implementable at least for them..

3. Now, I did further research and finally came up with the solution myself and then support implemented that change and it started working like butter!

The little change that is required in such cases is to Run PHP as CGI rather than apache. This change immediately fixed all problems and I was relieved.

But I wonder why did’nt Knownhost support suggested this themselves. Its hard to believe that they did not know of this simple solution…  So, I have written this post to help people who get stuck by this issue and who find no help from hosting support..