I’m using XAMPP on Mac OSX to design my WordPress themes, and now my setup features:
- a sensible, unique hostname for my local site (eg. memelab.dev)
- prettylinks using url rewrite
- functioning WordPress and plugin updates
- a wp-config.php edit which eliminates the need to edit the database when uploading the site to the production server
This is pretty straight forward, but for the sake of completeness, I’ll mention this comprehensive guide from Six Revisions (which I haven’t examined too closely, but looks solid).
I found that my prettylinks failed when I initially installed… I think this is fixed in later versions of XAMPP. I’m running XAMPP 1.7.3, and I don’t recall needing to do anything on since upgrading, but if you’re having trouble, you may need to edit some config files. You can open them in TextEdit.app if you don’t have a favourite editor (I love TextMate) by adapting the following:
sudo open -e “/Applications/XAMPP/etc/httpd.conf”
You may need to:
Enable URL rewrite) by opening
xampp/xamppfiles/etc/httpd.confand deleting the hash/pound sign at the front of the line to uncomment:
LoadModule rewrite_module modules/mod_rewrite.so
Fixing Permalink problems
When I intially had trouble (several years ago I think) the post which helped me out was:
“…Clean URLs do not work out of the box on XAMPP 1.5.x with PHP4 due to a problem in Apache’s module load order…
“ Clean URL support in XAMPP
Bottom line – its working a charm now!
Configure local servers
To access your local site at an address like http://memelab.com.au/wp/, you’ll need to configure XAMPP. XAMPP stores its virtual hosts configuration in a separate file called httpd-vhosts.conf, which is not actually used by default, so:
/xampp/xamppfiles/etc/httpd.confuncomment the line:
- You can now make entries into
httpd-vhosts.conf. There is an example in there – adapt it to your needs!
- Enter your hostname into
(Your hosts file is not visible in finder, and needs to be edited with admin privileges, so open the terminal and paste:
sudo Open /Applications/TextEdit.app /etc/hosts
- Reload apache, and you’re done! (XAMPP control > Modules > Restart Apache).
I adapted my solution from a post in the WordPress Codex.
Enable WordPress updates whilst using XAMPP
This is the breakthrough which has prompted this post, thanks to Ian at messaliberty.com. If you’ve come this far, you’ll have no trouble returning to
/xampp/xamppfiles/etc/httpd.conf and replacing
You can find more detailed instructions at the source:
edit the XAMPP apache config file to run it as your local user.
How to fix WordPress automatic upgrades and plugin installs on XAMPP
(And make sure that LittleSnitch, if you use it, is allowing httpd to access wordpress.org)
Ordinarily, migrating your database to your local installation, and vice-versa requires that you the WordPress database – in particular the WP_HOME and WP_SITEURL. Ian at messaliberty.com again has a solution! This is working well for me:
“set-up the wp-config.php to check to see if it is a local server, if it is then set the configuration one way, otherwise set it using the production values”
create a single wp-config file for local and remote WordPress development
A bonus tip on whilst we’re here – Joost has offered this addition:
“a quick hack I do in almost all WordPress installs I manage, that allows me to quickly switch on debug mode when needed”
Joost – Simple WordPress debuggin
Next recommendation from me: use some versioning software – I use Versions.app, which is a simple SVN client for the mac.