WordPress FTP Error when upgrading WordPress core or plugin

WordPress FTP Error fix

You go to update a plugin or the latest security patch for WordPress, but when you click update you’re prompted for FTP credentials. It can be frustrating and annoying, but it has (typically) a simple fix. This WordPress FTP error is frustration at its peak.

You’ll need access to your wp-config.php file and ssh access to your server.  Two steps:

  1. Apache server — via terminal/command line run sudo chown -Rf www-data:www-data /var/www/html (or could just be /var/www; all depends on your directory structure)
  2. (Optional) Add this line to your wp-config.php file: define('FS_METHOD', 'direct');

The first step is giving the process www-data ownership permissions to update all files/directories without FTP access. Typically Apache servers run as www-data or sometimes httpd. To verify/determine your server’s setup, run ps aux | grep apache or ps aux | grep httpd.

The second step is to force WordPress to use the File System method of downloading/uploading files for updates. Only set this if step #1 doesn’t fix your FTP credential issue. For more information regarding the FS_METHOD, read this.

And you should now be done. I hope that helped.

(Visited 45 times, 1 visits today)

If you found this post useful ...

Buy Me a Coffee logo
Wondering why you keep seeing lower-cased 'i' in my posts? Read -> Why ‘i’ is not capitalized
0 0 votes
Article Rating
Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
edit the dissertation
4 years ago

I also faced this error and I thought that the problem was in a plugin. Now, I understand that my thoughts were wrong about it. Anyway, thank you for this explanation.

2
0
Would love your thoughts, please comment.x
()
x