Login with  Log in with facebook
Hiring Manager? SIGN UP HERE

What is the easiest way to activate PHP and MySQL on Mac OS 10.6 (Snow Leopard)?

I'd prefer to use any bundled versions before resorting to downloading from the PHP or MySQL websites.

I'm comfortable at the command line in Terminal

Arpit Nandwana
07/08/2011 at 04:42
2 Answers

Open a good text editor (I'd recommend TextMate, but the free TextWrangler or vi or nano will do too), and open:


Find the line:

"#LoadModule php5_module        libexec/apache2/libphp5.so"

And uncomment it (remove the #).

Download and install the latest MySQL version from mysql.com. Choose the x86_64 version for Intel (unless your Intel Mac is the original Macbook Pro or Macbook, which are not 64 bit chips. In those cases, use the 32 bit x86 version).

Install all the MySQL components. Using the pref pane, start MySQL.

In the Sharing System Pref, turn on (or if it was already on, turn off/on) Web Sharing.

You should now have Apache/PHP/MySQL running.

In 10.4 and 10.5 it was necessary to modify the php.ini file to point to the correct location of mysql.sock. There are reports that this is fixed in 10.6, but that doesn't appear to be the case for all of us, given some of the comments below.

Dewasish Mitruka
07/08/2011 at 06:22


To complete your setup or MySQL:

sudo vim /etc/profile
  1. Add alias

    alias mysql=/usr/local/mysql/bin/mysql
    alias mysqladmin=/usr/local/mysql/bin/mysqladmin
  2. Then set your root password

    mysqladmin -u root password 'yourPassword'
  3. Then you can login with

    mysql -u root -p
Dewasish Mitruka
07/08/2011 at 06:23

If you want to post any answer to this forum then you need to log in.
Schedule a Demo

Schedule a Demo with us

Name *
Email *
Phone *
Company *