Yup, it’s time for the WordPress upgrade dance, yet again – 2.9 Carmen has just been released and everyone using WordPress is being “urged” to upgrade.
Now, I’m slightly ashamed to admit it, but up until last week I hadn’t been upgrading regularly. It had seemed like in order to be able to use WordPress’s “Upgrade Automatically” functionality I had to either enable FTP (ewwww), or FTPS (seemed like a lot of effort, and needed the SSH extension for PHP installing). So, I’d ended up doing an upgrade every now and then manually. Not the best plan in the world.
So, last week I decided to take another look and see if there wasn’t a more sensible way to enable WordPress to run its “Upgrade Automatically” code. Turns out there is – just make sure the directory you’re running WordPress under is owned by the same user that your web server is running as. Do this, and suddenly “Upgrade Automatically” works, and you’re a happy camper.
And how to do that? Simple. First, find out which user your web server is running as:
ps aux | grep apache
Generally, the answer will be
www-data. Then, once you’ve worked out who the server’s owner is, change the owner of your WordPress directory tree:
chown -R www-data:www-data /path/to/wordpress/
Then, when you go back into WordPress you’ll be able to click on the “Upgrade Automatically”, and WordPress will actually upgrade itself. Hooray! (Of course, don’t forget to back up before you do this. I am not responsible for your data, follow instructions at your own risk, Santa Claus is real, etc.)
Hopefully this is of use to someone out there. It’s certainly made me happier about the whole upgrade dance.
As Chris so rightly points out below, leaving things open to the web server to change willy nilly can be a little silly, so after running the update do another
chown, this time changing the ownership back to your username and group.
If you enjoyed this post, subscribe to The Code Train and read more when I write more.