Vous êtes sur la page 1sur 5

Install Apache/PHP/MySQL on Snow Leopard http://maestric.

com/doc/mac/apache_php_mysql_snow_leopard

Install Apache/PHP/MySQL on Snow


Leopard

Apache
Start Apache

sudo apachectl start

Check it's working: http://localhost/

PHP
In /etc/apache2/httpd.conf , uncomment this line:

LoadModule php5_module libexec/apache2/libphp5.so

Restart Apache

sudo apachectl restart

Fix a warning appearing in phpinfo()


Create /etc/php.ini and make it writable

cd /etc
sudo cp php.ini.default php.ini
sudo chmod 777 php.ini

In php.ini , find this line:

;date.timezone =

1 of 5 11/18/09 7:51 PM
Install Apache/PHP/MySQL on Snow Leopard http://maestric.com/doc/mac/apache_php_mysql_snow_leopard

Uncomment it and insert your time zone (http://php.net/manual/en/timezones.php)

date.timezone =America/Vancouver

Restore php.ini permissions

sudo chmod 444 php.ini

Restart Apache

sudo apachectl restart

MySQL
Download the MySQL package for Mac OS X.5 (32 or 64 bits depending on your machine)

Install everything in the package in this order: mysql, the startup item, the preference pane.

Start MySQL in the preference pane.

Test it's working:

/usr/local/mysql/bin/mysql

Fix mysql.sock location in php.ini


In /etc/php.ini , replace the three occurences of /var/mysql/mysql.sock by
/tmp/mysql.sock

pdo_mysql.default_socket=/tmp/mysql.sock
mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock

Restart Apache

sudo apachectl restart

Reference
http://wordpress.org/support/topic/306878

http://stackoverflow.com/questions/1293484/easiest-way-to-activate-php-and-mysql-on-mac-
os-10-6-snow-leopard

2 of 5 11/18/09 7:51 PM
Install Apache/PHP/MySQL on Snow Leopard http://maestric.com/doc/mac/apache_php_mysql_snow_leopard

Feedback
fi eg
Works great! Thanks. September 21, 2009
#1

Dae
Thank you very much! September 21, 2009
#2

Nick
Very simple, worked perfectly, thanks! One point, you can restart apache with just one September 22, 2009
command: sudo apachectl restart #3

Jérôme Jaglale
Thank you Nick, that's fixed :) September 22, 2009
#4

Vik
Thank you very much! Great tutorial. September 30, 2009
#5

Boone
Awesome! Thanks for this extremely clear tutorial. September 30, 2009
#6

zb
Fantastic job! Easiest install tutorial seen yet, perfectly clear and concise! October 5, 2009
#7

Chris
Nice. Thanks! October 7, 2009
#8

Tricia
This is excellent! Thank you. October 10, 2009
#9

ricbax
This is not an install! These are instructions to get the compiled and installed version on Snow October 13, 2009
Leopard started and working with PHP and MySQL. What's the difference you ask? Too much to #10
explain here. These instructions only work on a fresh install of Snow Leopard.

3 of 5 11/18/09 7:51 PM
Install Apache/PHP/MySQL on Snow Leopard http://maestric.com/doc/mac/apache_php_mysql_snow_leopard

Jérôme Jaglale
Yes ricbax, a more accurate title would be "Start Apache, activate PHP and install MySQL on October 13, 2009
Snow Leopard" My apologies :) #11

Luc
Very nice. Do you have any pointers about how to get phpmyadmin working for those of us October 13, 2009
who like a graphical mysql database manager? Thanks, -Luc #12

Charles
Good Good Good Good Good Good !!! thx October 16, 2009
#13

Jonah
Thanks! This was very helpful. October 19, 2009
#14

Johan
Thanks, Works great! October 20, 2009
#15

Johan
When trying to enable the mysql prefpane I get a message that System Preferences has to October 20, 2009
restart – this because the MySQL.prefPane is a 32-bit app. Found an alternative version of the #16
app for Snow Leopard here that solved the issue: http://www.swoon.net/site/software.html

Grb0
This is NOT INSTALLING ! This is ENABLING... Thanks for the misleading title. October 23, 2009
#17

Marcio Toledo
Perfect! It's the first time that I can end with sucess. So, how to I creat an url like: (mntoledo@gmail.com)
marciotoledo.local/ and this open and website on folder? Thanks. October 23, 2009
#18

Teej
Trying to open httpd.conf file to uncomment the php line and having trouble as it is a root file? October 24, 2009
This tutorial may help.. http://www.anujgakhar.com/2009/01/19/how-to-edit-httpdconf- #19
on-macos/

Samuel
Great! Worked like a dream! November 5, 2009
#20

Konix
Thanks!!...i was having problems installing mysql. all got resolved November 5, 2009
#21

4 of 5 11/18/09 7:51 PM
Install Apache/PHP/MySQL on Snow Leopard http://maestric.com/doc/mac/apache_php_mysql_snow_leopard

Ed
thanks for being so informative! helps a lot.. also the way it's written.. So pleasant to follow! November 7, 2009
Big thanks! #22

perfect. Thanks. November 9, 2009


#23

David
Worked perfectly. Thanks November 11, 2009
#24

decarola
straight to the point, really good November 15, 2009
#25

Vasily
Thanks a lot November 15, 2009
#26

Saud
Simple steps. Great job. Thanks a lot November 17, 2009
#27

otsy
thanks a gig! November 18, 2009
#28

Message

Name

Submit

5 of 5 11/18/09 7:51 PM

Vous aimerez peut-être aussi