Beware this content is over 9 years old and considered stale. It may no longer be accurate and/or reflect the understanding of the author but remains here for reference only. Please keep this in mind as you use this content.

As a little memo to myself and for anyone else who is having trouble getting the WordPress automatic upgrade feature working, particularly if your on a Linux (CentOS 5) VPS with 1&1 Hosting.

I have great admiration for the WordPress auto-upgrade feature particularly as it saves you loads of time especially if you administer a number of WordPress based websites not to mention your own blog.

The convenience of the auto-upgrade is obvious, although most people quite rightly would prefer to manually upgrade a WordPress installation particularly if the installation is heavily customised. Needless to say, the auto-upgrade feature does not negate the usually and very necessary manual backup of your database and your wp-content folder if you’ve installed a number of themes and plugins, but once you’ve done so it’s nice to let WordPress do the rest of the hard work.

For a while on this blog, when I attempt to do the automatic WordPress upgrade I am greeted with the FTP login details screen, asking me for my username and password to allow the download and upgrade of the WordPress installation to happen. On other websites (some running on a Windows server) this is interstitial page doesn’t even show up and the upgrade happens virtually instantly, no FTP login details screen, just straight to the downloading and upgrade. So’ve I’ve been wondering how to get this working for my own blog on a Linux distro.

I stumbled across this well written blog post on ‘Why WordPress Asks for Connection Info’, the main problem is a ownership/permissions issue and this can be quite quickly corrected if you know what process Apache runs as on your server.

Some blogs have mentioned it to run as www or httpd, but for me and I’m guessing other 1and1 users it is most likely running as apache but there is a quick and easy way of finding out, by running the following PHP script:

<?php echo(exec("whoami")); ?>

Once you know what name Apache goes by, you need only login to your server via SSH as root and change the ownership of the WordPress installation directory to Apache, but wait - there is a catch, going ahead and changing the ownership of the directory to just Apache will prevent you from making any changes to the directory if your not Apache, so if you login via FTP and you want to upload some new plugins or themes, you won’t be able to.

To ensure you and Apache have the correct permissions you need to know what your username is and this can be easy if you login by FTP as any decent FTP client, such as FileZilla, will show the owner of the directory when you login.

In case your not sure, you can find all the usernames within /etc/passwd but once you know you then need to navigate from the root directory to your website directory where the actual files and the WordPress installation directory is found. In case your not sure it would most likely be something like /var/www/vhosts/ for 1and1 Linux VPS users.

Once you know where you are and what your username is, you can run the following command via SSH as root:

chown -R yourusername:apachegroupname wordpressdirectory

What this line does is it changes the file owner and group for all files and folders in subdirectories of the directory wordpressdirectory, i.e. recursively. So for me, assuming I’m already in the website folder at /var/www/vhosts/ it would be something like:

chown -R artofsimplicity:apache blog

That should be it. WordPress may still ask you for the FTP password but it should have no problems upgrading the installation or upgrading any plugins that have updates without you needing to do anything else (I’m assuming you’ve already backed up anything you wouldn’t want to lose).

If you’re still having issues, drop a line below and I’ll try and help or let me know if the above has been helpful for you.