AMP on Leopard

Operating System Add comments

Many web developers work with AMP (Apache+MySQL+PHP). Me, too. Leopard comes with Apache 2.2 and PHP 5. It’s so easy to enable them.

1. Apache

To enable Apache, check the Web Sharing in System Preferences > Sharing.

2. PHP

To enable PHP, open Apache’s configuration file (/etc/apache2/httpd.conf) and enable the following line:

LoadModule php5_module libexec/apache2/libphp5.so

After modifying this file, you should restart Apache by unchecking/checking the Web Sharing or using the following command:

$ sudo /usr/sbin/apachectl restart

3. MySQL

First, download MySQL’s installation package for Mac OS X (dmg) from MySQL’s website. It’s not included in Leopard.

There’re two Installer Package (pkg) files in the file you downloaded. One is the installer of MySQL, the other named MySQLStartupItem.pkg is used for starting MySQL automatically during system startup. Furthermore, a Preference Pane file named MySQL.prefPane lets you start/stop MySQL in System Preferences > MySQL.

After installing MySQL, configure PHP to work with it:

$ cd /etc
$ sudo cp php.ini.default php.ini

Then open this newly created php.ini and set the mysql.default_socket and mysqli.default_socket to:

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

Restart Apache again and you have the AMP on your Leopard now!

Leave a Reply

© 2008~2010 Pterodactyl Fung | Powered by WordPress | Design by N.Design Studio
XHTML CSS RSS Log in