Alright! I’ve decided to  equip my Macbook with Apache, PHP and MySQL. Reason? Well, working on stuff offline and sync the works later — faster development on my personal time this way. I think…

First, my Macbook OS is not latest, still a Leopard. 10.5.8. Here we go…

Mac OS X ver. 10.5.8
My OS Version


Enabling Apache on this Mac is very simple! Go to “System Preferences” > “Sharing”.
From the check-boxes, select “Web Sharing”. That should do it.

Sharing Options
Web Sharing

To ensure this working accordingly, just go to your browser and point it to “http://localhost”. But then, the default “Home” location may not be the place you want it to be. So let’s move the “Home”. We need to edit “httpd.conf”.

On my Mac default installation, this file is located here:


And if you list the folder, you’ll probably seeing things exactly like this:

drwxr-xr-x  13 root  wheel    442 Nov 25  2007 extra
-rw-r--r--   1 root  wheel  17757 Jan 30 17:57 httpd.conf
-rw-r--r--   1 root  wheel  17669 Jan 30 15:24 httpd.conf_ori
-rw-r--r--   1 root  wheel  12958 Nov 25  2007 magic
-rw-r--r--   1 root  wheel  28782 Nov 25  2007 mime.types
drwxr-xr-x   4 root  wheel    136 Nov 17 11:30 original
drwxr-xr-x   5 root  wheel    170 Jan 30 17:54 other
drwxr-xr-x   4 root  wheel    136 Nov 17 11:24 users

There are two places where you need to change the specifics:

DocumentRoot "/Library/WebServer/Documents"

Change to:

DocumentRoot "/where/you/want_it"

Here is mine:

New "Root" Location
New "Root" Location

The other place on the same file:

<Directory "/Library/WebServer/Documents">

Change it to the same path you use earlier. Here’s mine:

Use the same "Root" location
Use the same "Root" location

Additionally, please comment “#” the following lines of your httpd.conf as well. This is to ensure your PHP installation later on works well.

#LoadModule php5_module        libexec/apache2/
#LoadModule fastcgi_module     libexec/apache2/

Restart your “apache” service. And you’re pretty much done on this section here.

The following commands may come handy:

Ln-Mac: Luqman# sudo apachectl start
Ln-Mac: Luqman# sudo apachectl stop
Ln-Mac: Luqman# sudo apachectl restart


The Macbook has a default install of PHP. But somehow, it didn’t work the way I want it. Urghhs.. Well forget about it. I decided to use a PHP Apache Module from here for my installation:

Upon download completion, run the package; Entropy PHP 5.3.0-3.pkg and follow the instructions.

Just to note; my PHP installation located here:


And my php.ini is here:

PHP path and php.ini file
PHP path and php.ini file

Alright, now we have to tell our Apache where is our PHP installation/path is. Add the following line into httpd.conf:

LoadModule php5_module        /usr/local/php5/

Now, let’s give it test. Go to your root folder. Create an index.php file and add the following into the file, close and save it.

<?php phpinfo() ?>

Go to your browser and point to http://localhost and you should see something similar to below (well if you have same OS and the same PHP version as I am, you will see exactly the same 🙂 ) :

PHP Info
PHP Info () - PHP5 Installation Successful

Okay, so far so good. Next, MySQL.


I use MySQL package [Mac OS X 10.5 (x86, 32-bit), DMG Archive] downloaded from here:

Inside the package, there are four items (as shown below); but I only install mysql-5.5.8-osx10.5-x86.pkg — the rest I don’t really need them.

MySQL 5.5.8 Package
MySQL 5.5.8 Package

Run the package and follow the instructions to complete the installation. My installation has the MySQL path here:


But the installation create a symlink for you (nice), so you don’t have to type everything every time:


Now, first thing I do is to change my root password from whatever the default is. I believe the default root password is <blank>. I’m not too sure, I don’t care and I just want to change it to something I know. To do it, will have to bring the mysqld up and running. Run the following command:

cd /usr/local/mysql/
sudo ./support-files/mysql.server start
./bin/mysqladmin -u root -p password

Enter <blank> , then follow by your new password and retype your password to confirm. Done!

Since I am not a trained Database administrator; I know very basic about mysql. To go around and do simple management of this mysql installation, I also install “PhpMyAdmin”.


I downloaded phpMyAdmin-3.3.9-english.7z package. And then un-package the whole thing in ” phpmyadmin ” within my root folder ( /Users/www/phpmyadmin/ ).

Goto your phpmyadmin folder, and make a copy of this file:

and rename it to:

Open and change the following line:

$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! *


$cfg['blowfish_secret'] = 'YouMustPutSomethingHere'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! *

Where ” YouMustPutSomethingHere ” is your secret word or any word you prefer.

Okay, with that done; now you restart everything.

sudo apachectl restart
cd /usr/local/mysql/
sudo ./support-files/mysql.server restart

I think that’s all, and it should do it. You can begin your development works locally on your Mac. Happy coding…!