Apache, MySQL, PHP and WordPress
I’ll be doing some work with WordPress on another musician’s website. WordPress is an open source content management system. The blog you are reading is powered by WordPress.
Typically, a WordPress blog is driven by a LAMP server: Linux, Apache, MySQL and PHP. Because I run a Mac, I can host a WordPress environment on my local machine. I can use a Mac as if it were a LAMP server.
Apache is enabled by simply turning on Web Sharing under the Sharing option of System Preferences. Or, if you are a diehard Unix geek, you can bring up the Terminal app and enter:
sudo apachectl start
Make sure you have your root password handy.
PHP is installed in Mac OS X by default, but not enabled. To enable it, the Apache 2 configuration file, which is located at /etc/apache2/httpd.conf, has to be edited. There is a line which loads the PHP 5 module, which looks like this:
#LoadModule php5_module libexec/apache2/libphp5.so
Remove the comment symbol, #, and save the file. And restart Apache.
sudo apachectl restart
I had to download MySQL and install it myself. Not the most user friendly database install. And, even though I had the database up and running, my local install of WordPress would not connect to the database. It turns out that I had to edit a line in the wp-config.php file to replace localhost with a default IP address:
After a few hours of Unix hacking, I had a full WordPress development machine on my Mac. Just like using a LAMP server on my ISP. For whatever reason, it felt good to still be able to hack around Unix, Apache, MySQL, PHP and WordPress.
I am a hopeless geek.
I’ll be joining your mac cult soon. So I guess you’ll be the one I call when I confuse myself while attempting to right-click 😉