Tuesday, April 12, 2011

Apache MySQL PHP on Mac OS X Snow Leopard

In Mac OS X, you already have built-in Apache web server and you only need to activate it by going to System Preferences -> Sharing -> then check the "Web Sharing". That's it! And you already have your web server running. Just check it by typing "http://localhost" or "http://localhost/~yourusername" in your web browser.

PHP
After that, you can open Terminal and open /private/etc/apache2/httpd.conf file and uncomment this line:
LoadModule php5_module           libexec/apache2/libphp5.so
 then restart Apache service by uncheck - recheck Web Sharing in System Preferences

MySQL
1. Download package from here
2. Install everything: mysql, startup item, preference pane
3. Start MySQL in Preference Pane

Do the following to fix some stuffs:
$ cd /etc
$ sudo cp php.ini.default php.ini
$ sudo chmod 666 php.ini
In php.ini file, edit following:
1. uncomment this line and insert TimeZone:
date.timezone =Asia/Jakarta
2. find all three occurences of /var/mysql/mysql.sock and change to /tmp/mysql.sock
pdo_mysql.default_socket = /tmp/mysql.sock
mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock
3. change this line from "Off" to "On"
short_open_tag = On
Restart Apache service by uncheck - recheck Web Sharing in System Preferences

No comments:

Post a Comment

Hi, for all of those who already put comments on my blog post, thanks.. really appreciate it. And for those who have not, just put your comments here :)