Page 1 of 1

Install and configure PHP and MySQL on Mac OS X 10.5.* ( Leopard ) This is step-by-step tutorial of installing and configuring PHP and My Rate Topic: -----

#1 MitkOK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 32
  • View blog
  • Posts: 403
  • Joined: 09-August 07

Posted 12 June 2008 - 11:59 PM

Surfing the net I found out that people are having problems installing and configuring PHP and MySQL on Leopard.
Here are some simple steps to solve these problems :

Install and configure PHP:

By default PHP and Apache2 are installed on Leopard and the only thing is to enable php module for apache and run the server

1. Open /etc/apache2/httpd.conf and find the line:
 #LoadModule php5_module		libexec/apache2/

Uncomment it ( remove # ) and save the file.

Posted Image

2. Go to System Preferences -> Sharing and check 'Web Sharing'

Posted Image

3. You can place your php files in your /username/Sites directory and view it at where username is your account name.

Posted Image

Posted Image

Posted Image

Install MySQL:

1. Go to and download the package for Leopard :

Posted Image

2. Install the packeges and MySQL.prefPane

3. Go to System Preferences -> MySQL and start the server

Posted Image

Posted Image

4. The last thing to do is to to chnage one line in your php.ini file:


mysql.default_socket = /tmp/mysql.sock

Congratulations. You have PHP/MySQL ready to use OS ;)

Author : Mitko Kostov

Notice : During some of the steps root access is required. Tested on 10.5.2 and 10.5.3.

This post has been edited by MitkOK: 17 June 2008 - 09:08 AM

Is This A Good Question/Topic? 0
  • +

Replies To: Install and configure PHP and MySQL on Mac OS X 10.5.* ( Leopard )

#2 level1  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 65
  • Joined: 12-June 08

Posted 17 June 2008 - 01:33 PM

I am using 10.4, and got everything working using mostly the tutorial above but I still think a few things were left off of this tutorial. I'm adding them here:

After you get mysql installed do this from Terminal:
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &

/usr/local/mysql/bin/mysqladmin -u root password XXXX

where XXXX is a password you make up. Don't forget it, write it down store it, save it, keep it love it. What you've done is added a password to the root user for mysql. The root user is root and there is no default password - meaning if you don't add one anyone with access can connect to your mysql db under the user root with no password - scary! I referenced this page so look there for more info.

Now test your connection out - in the code below replace XXXX with the password you just made up
$hostname = "localhost";
$username = "root";
$password = "XXXX";
$conn = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR); 

save this in your Sites folder with a .php extension.

if you don't get an error you are golden!

Now you are safe to play around and you already have the code to connect to mysql :D
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3603
  • View blog
  • Posts: 10,571
  • Joined: 08-June 10

Posted 12 August 2010 - 12:17 PM

if Leopard’s default PHP installation doesn’t fit your needs (you need some extra functions/extensions, e.g. the Suhosin patch, mysqlnd, WDDX) you can install PHP/MySQL from MacPorts. this way you can also keep your installations up to date.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1