How to Setup PHP, MySQL and phpMyAdmin on Mac OS X Snow Leopard

My previous working setup was on WAMP( Windows, Apache, MySQL and PHP). On Windows I used a bundled app WampServer that did the job, just install the executable and your all set.

On Mac it kinda needs a bit of work but basically you have to configure PHP, download-install MySQL and phpMyAdmin.

I wrote a short tutorial below to cover the installation.

1. Setup php

Mac OS X Snow Leopard includes PHP 5.3.x version by default, you simply need to enable it to start using it.

You can use a text editor or use the Terminal, I prefer to use the latter.

a. To launch Terminal go to Applications > Utilities > Terminal

b. On Terminal change directory to /etc/apache2

# cd /etc/apache2

c. Use your favorite editor, I use Vi, open up httpd.conf

NOTE: The file has write permission, so you need to sudo in order to make changes, if you haven’t created a password yet for your account, this is the perfect time to create one.

Go to  System Preference > Accounts > Set the password for your account. Once done continue with the terminal

# sudo vi httpd.conf

If prompted for your password enter the password.

d. Do a search for .php and uncomment the line

#LoadModule php5_module        libexec/apache2/

To do a search type /.php on the vi editor and hit Enter

e. Exit and Save

Hit the Esc key and type 😡 to exit and save

2. Start Sharing by opening System Preferences, clicking on “Sharing” under Internet & Wireless and then check  “Web Sharing”.

Congrats PHP is enabled.

2. Install MySQL

a. Download the package from

b. Pick the 64 bit version.

c. After mounting, go over the readme.txt for more information.  Install the mysql-5.1.56-osx10.6-x86_64.pkg, go through the wizard.

d. Then also install the startup package which will start the MySQL server when you start your Mac.

e. You should be able to connect to the MySQL server, byrunning /usr/local/mysql/bin/mysql’ on the command line

3. Next for managing your database with a GUI

a. Go ahead and download phpMyAdmin from

b. I extracted the folder inside my local folder.

c. Read the documentation for ways on how to setup authentication for phpMyAdmin either by cookie or config.

d. One thing to note is the configuration for the mysql socket.

$cfg[‘Servers’][$i][‘socket’] = ”;

e. To find out where it is located type the command ‘status’ on the Terminal when logged in to Mysql.

Connection id: 36

Current database:

Current user: pauloorquillo@localhost

SSL: Not in use

Current pager: stdout

Using outfile: ”

Using delimiter: ;

Server version: 5.1.56 MySQL Community Server (GPL)

Protocol version: 10

Connection: Localhost via UNIX socket

Server characterset: latin1

Db characterset: latin1

Client characterset: latin1

Conn. characterset: latin1

UNIX socket: /tmp/mysql.sock

Uptime: 7 days 2 hours 30 min 9 sec

f. You should see something like above note the UNIX socket and edit your phpmyadmin config file

$cfg[‘Servers’][$i][‘socket’] = ‘/tmp/mysql.sock’;

That should be it you should be up and running. Happy coding.

Leave a Reply

Your email address will not be published. Required fields are marked *