Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,487 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,113 people online right now. Registration is fast and FREE... Join Now!




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

 
Reply to this topicStart new topic

> 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

MitkOK
Group Icon



post 12 Jun, 2008 - 10:59 PM
Post #1


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:
CODE
#LoadModule php5_module        libexec/apache2/libphp5.so


Uncomment it ( remove # ) and save the file.

IPB Image

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

IPB Image

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

IPB Image

IPB Image

IPB Image

Install MySQL:

1. Go to http://dev.mysql.com/downloads/mysql/5.0.html and download the package for Leopard :

IPB Image

2. Install the packeges and MySQL.prefPane

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

IPB Image

IPB Image

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

QUOTE
mysql.default_socket = /tmp/mysql.sock



Congratulations. You have PHP/MySQL ready to use OS wink2.gif

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 Jun, 2008 - 08:08 AM
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

level1
*



post 17 Jun, 2008 - 12:33 PM
Post #2
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:
CODE
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &

then
CODE
/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
CODE
<?php
$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 biggrin.gif
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 11/22/08 04:07PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month