wpfix.py: allow your Linode WordPress sites to auto-update

We’re moving our client sites and other activities away from Dreamhost to Linode, and one of the features that’s really nice is how the WordPress auto-update mechanism works. While it’s a neat trick to be able to upgrade an application from within itself, the design of PHP/Apache/WordPress requires either FTP access (boo!) or for WordPress’ files to be owned by the web server user (not always practical, especially in a low-memory VPS environment.)

Once again, Something Awful comes to the rescue with instructions on setting appropriate user permissions and making a wp-config.php change. It’s summarized in Geoff’s weblog – essentially certain wp-content directories become owned by www-data, and a new constant (FS_METHOD = ‘direct’) gets defined in wp-config.php.

I’ve written a terrible Python utility to automate this, called wpfix.py. It’s run from the command line as root, and takes a path to a WordPress installation. It will perform all the permission changes and edit the wp-config.php file for you. If it can’t, it will at least fix the permissions and let you know the change to make.

Update 2012-01-10: The latest version of wpfix.py is now in my scripts repository on GitHub.

Comments are closed.