I was in the process of updating a WordPress installation which I had inherited from another developer and which was installed on a different server environment to mine when I came across the notice:

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed

“That’s odd”, I thought, as normally I’ve never had to enter FTP credentials to perform updates before. First thing I checked was file permissions - all looked ok (although it showed the owner of the relevant directories for updating WordPress as being apache, not the domain owner - I changed these via SSH using chown but it made no difference). I then did some searching and came across the following bit of code:

define('FS_METHOD','direct');

This was placed in wp-config.php (although it was removed immediately after as it is only recommended to change it temporarily if you’re experiencing update problems). What this does is force the updates to use Direct File I/O requests from within PHP. So I tried this out with no luck as it threw the error:

Could not create directory.: xxxxxxx/wp-content/upgrade/wordpress-4.tmp​

A couple of hours later having looked over and over at the hosting set up and permissions, comparing to other WordPress installs to try and find out what was wrong and I finally stumbled across the answer and it was related to the file ownership I had looked into earlier.

The site was hosted on Plesk and all I need to do was to switch the site to run in FastCGI mode (it was running as Apache module), so that PHP script runs under the PHP user and there is no ownership conflict. Otherwise PHP scripts run in mod_php mode and executes under Apache user. I’ve been using FastCGI by default so didn’t think to look at this.

There were a lot of solutions online to the general errors I experienced but none of which resolved the issue in my case so I hope this will be of help to anyone else in the same boat!


comments powered by Disqus