Update WordPress without FTP

Joaquín Ruiz - 27th August 2016

Update WordPress without FTP
  • Date:   27th August 2016
  • Category:

      WordPress

  • Comments:

      0

In some cases, WordPress asks you for your FTP details when trying to update WordPress core version, or to update WordPress plugins. This is a common issue whereby the WordPress system can’t write to your /wp-content folder, therefore you need to provide WordPress an FTP user that can write to that folder.

This is annoying when you need to update WordPress on local environments or in environments without FTP access, and then you need to know how to Update WordPress Without FTP.

According to WordPress codex (https://codex.wordpress.org/Updating_WordPress), “If the files are owned by the owner of the current process (i.e., the user under which the web server is running), and new files created by WordPress will also be owned by that user, WordPress will directly modify the files all by itself, without asking you for credentials.”

Therefore, I’m going to show you how to automate the WordPress updates in a local environment on a Mac OS X El Capitan, with a native Apache installation.

1. You are asked for FTP credentials:

FTP Credentials. Update WordPress without FTP
FTP Credentials. Update WordPress without FTP

Then… WTF?

2. Check your WP files user-group

1. Open the terminal

Open Terminal. Update WordPress without FTP
Open Terminal. Update WordPress without FTP

2. Go to your WordPress folder and check which user has rights over the WordPress files.

$ cd $HOME/Sites/wordpress
$ ls -la
WordPress files. Update WordPress without FTP
WordPress files. Update WordPress without FTP

In this case, as seen in the image above, our user is ‘jokiruiz’. Therefore what we need to do is to add this user ‘jokiruiz’ to the Apache2 config file.

3. Add the user to Apache

1. Open the terminal

2. Go to Apache configuration folder

cd /etc/apache2

3. Edit the config file

sudo nano httpd.conf

4. Look for this lines:
User _www
Group _www

5. And change them to your configuration:
User jokiruiz
Group _www

In my case, I have jokiruiz on the group _www, so I don’t need to change the group.

4. Reload Apache

To see the changes, use the command below to restart Apache with the new configuration.

sudo apachectl restart

5. And enjoy!

Press update from your WordPress admin area, and you won’t be asked for FTP details any more. Learn more about WordPress here.

WordPress udpated. Update WordPress without FTP
WordPress udpated. Update WordPress without FTP

The Author

Joaquín Ruiz (aka Joki)
Joki is a Computer Engineer, Senior Full-Stack Developer and Lead Developer, specialized in web and e-commerce. Joki has also a wide international experience as freelance and working in agencies.