How to Update WordPress Automatically Without Using FTP

Posted by Joaquín Ruiz on 27th August 2016

How to Update WordPress Automatically Without Using FTP

In some cases, WordPress asks you for your FTP details when trying to update the core or the 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 Automatically Without Using 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:

connection-information

Then… WTF?

2. Check your WP files user-group

. Open the terminal

. Go to your WP folder and check the user

cd $HOME/Sites/wordpress
ls -la

Screen Shot 2016-08-27 at 18.01.15

If you see it, in this case, our user is ‘jokiruiz’. So what we need to do is to add this user to Apache2.

3. Add this user to Apache

. Open the terminal

. Go to your Apache configuration folder

cd /etc/apache2

. Edit the config file

sudo nano httpd.conf

. Search for this lines:
User _www
Group _www

. 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

sudo apachectl restart

5. And enjoy!

Screen Shot 2016-08-27 at 18.06.29




About the author:

Joaquín Ruiz is a Computer Engineer, Senior PHP Developer and Magento Certified Developer. Joki has more than 7 years of experience working with multiple PHP frameworks. He knows Magento, WordPress, Laravel, Yii.. like the back of his hand ;)