• 0

Hi Neowin: PHP and MySQL on Mac


Question

Hi Neowin,

I've been doing PHP/MySQL web development for a little while at work but having recently started using a Mac at home, I'm having problems getting some scripts to run on OS X Leopard....

The crux of it is that MySQL doesn't seem to want to play ball and I've read bits on enabling Web Sharing to start Apache/PHP etc I've searched around on the forums for a topic already covering this but there's so many topics I couldn't find anything!!

Anyone got any pointers/step by step guide to getting PHP/MySQL working smoothly on Mac OSX 10.5+ so I can develop bits at home without having to upload each script to a host in order to run it?!

Much appreciated

Dan

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

For 10.5 (it's slightly different for 10.6):

  • Edit the httpd.conf first to get PHP working:

- Open a terminal and change to the apache2 directory:
cd /etc/apache2


- Open the httpd.conf file for editing: sudo nano httpd.conf
- find and uncomment the line "LoadModule php5_module" (remove the '#' in front of it)
- Save the file (CTRL + X and and press 'Y' when asked about saving modified buffer)

  • Now to get PHP working properly you'll need to configure it - in terminal:
    cd /etc

  • By default, the PHP config file is called 'php.ini.default' and you need a copy called 'php.ini' - copy it:
    sudo cp php.ini.default php.ini

  • Now open the php.ini file:
    sudo nano php.ini

    , find the line that begins with 'mysql.default_socket' and edit it so it looks like this:

    mysql.default_socket = /tmp/mysql.sock
  • Save the file and close the terminal - open System Preferences > Sharing, and enable/restart web sharing, and as far as I remember from doing this, you'll now have a working MAMP installation.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.