How to fix WordPress automatic upgrades and plugin installs on XAMPP

If you’ve ever had problems with WordPress automatic updates on a local install of XAMPP this should fix it (note that I’ve tested it on OSX but it should work for Windows/Linux but the details will be different).  For a long time I just did the updates/installs by manually installing because the automatic upgrades never worked or it would ask for my ftp details.  And no matter what ftp details I entered it would never connect.  Same for plugin installs or updates.

Turns out that it has nothing to do with ftp settings, it was a simple file permissions conflict.  XAMPP was running its local Apache as user ‘nobody’ while the files on my hard disk were owned by my local user ‘ian’.  When WordPress came across this conflict it fell back to ftp mode but since it is a local install, that didn’t work.

[Just to clarify following Philip's comments below, because it is a permissions issue, the owner of the files and the user you set should match]

So what to do? The easiest thing to do is to edit the XAMPP apache config file to run it as your local user.  To find out your local user name, just launch terminal and in your home directory run:

ls -al

then edit the config file. If you are comfortable with using vi type this:

sudo vi /Applications/XAMPP/etc/httpd.conf

If not you can use the TextEdit app, you need to type this into the terminal:

sudo open -e “/Applications/XAMPP/etc/httpd.conf”

look for these lines:

User nobody
Group admin

and change them to:

User yourusername
Group staff

You’ll have to restart XAMPP’s Apache and if you attempted automatic updates before and failed, you’ll have to delete the upgrades folder inside wp-content.

Hope this helps other WordPress designers and developers using XAMPP. Please leave a comment or have a look at if it did :)