What's the simplest method to activate PHP and MySQL on Mac OS 10.6 (Snow Leopard)?

I'd would rather use any bundled up versions before turning to installing in the PHP or MySQL websites.

I am comfortable in the command line in Terminal.

Open a great text editor (I'd recommend TextMate, however the free TextWrangler or mire or nano is going to do too), and open:


Discover the line:

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

And uncomment it (take away the #).

Download and install the most recent MySQL version from mysql.com. Pick the x86_64 version for Apple (unless of course your Apple Mac may be the original Mac laptop Professional or Mac laptop, which aren't 64 bit chips. In individuals cases, make use of the 32 bit x86 version).

Install all of the MySQL components. While using pref pane, start MySQL.

Within the Discussing System Pref, switch on (or maybe it had been already on, switch offOron) Web Discussing.

You need to are in possession of Apache/PHP/MySQL running.

In 10.4 and 10.5 it had been essential to customize the php.ini file to suggest towards the correct location of mysql.sock. You will find reviews this is bound in 10.6, but that does not seem to be for people, given a few of the comments below.

To accomplish 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. You'll be able to login with

    mysql -u root -p

I have made clear all the steps needed (examined having a clean install of Snow Leopard).

This is an invisible folder. Just hit Command + Change + G (goes towards the Visit Folder food selection) and kind /etc/.

Then it will lead you to within that folder.

I strongly prefer HomeBrew over MacPorts for setting up software from source.

HomeBrew sequesters my way through /usr/local/Cellar therefore it does not spew files everywhere. (Yes, MacPorts keeps my way through /opt/local, however it requires sudo access, and that i don't trust MacPorts with root.)

Setting up MySQL is actually:

brew install mysql


To begin mysql, in Terminal type:


There's a method to start it upon boot, but I love to start it by hand.

I am less than sure as I am not too acquainted with Mac OS X, however i think this works in Snow Leopard too: 10.5: How you can enable PHP and MySQL in 10.5 UNIX.

I'd accept Benjamin, either install MAMP or MacPorts (http://world wide web.macports.org/). Keeping your PHP install separate now is easier and eliminates playing in the core PHP install if one makes any mistakes!

MacPorts is a little better for setting up other software, for example ImageMagick. Visit a full listing of available ports at http://world wide web.macports.org/ports.php

MAMP just does indeed PHP, Apache and MySQL so any future PHP modules you would like will have to be by hand enabled. It's incredibly simple to use though.