Installing Apache, PHP (with xdebug) and MySQL on Mac OS X Leopard
Actually, this is very easy to do, since Apache and PHP are already installed we only have to enable PHP, install MySQL and install xdebug.
Some people like to install other software like MAMP or XAMPP but i like to do it without installing other software other than Mac OS X shipped with, well of course we need to install some things but no all-in-one packages.
You may want to install the Developer Tools (xcode), you can find these on your Leopard DVD, or install the developertools from the apple site. These are required if we are going to compile extensions for PHP.
Lets start with enabling PHP, open up Terminal, and type: sudo nano /etc/apache2/httpd.conf and type in your password. Find the line that loads the php5 module:
#LoadModule php5_module libexec/apache2/libphp5.so
And remove the # before LoadModule.
Save the file (ctrl+x) and restart Apache, you can do this in System Pref’s by unchecking the Web Sharing service (Sys prefs > Sharing), or you can type it in Terminal: sudo apachectl restart
Lets install MySQL, i dont exactly know why apple did not ship this too, but fortunately MySQL made a nice prefpane for this. Download the package (dmg) at the MySQL website Install it, and start it in your pref pane (Sys prefs > MySQL)
Only thing we have to do now, is connecting MySQL with PHP, type in Terminal: sudo nano /etc/my.cnf and insert:
[client]
socket = /var/mysql/mysql.sock
[mysqld]
socket = /var/mysql/mysql.sock
and then:
sudo mkdir /var/mysql
sudo chown _mysql /var/mysql
All done, you now have Apache with PHP and MySQL, optionally we can install xdebug, there are a lot of known problems when doing this, so here’s what worked for me instantly:
Download the Komodo Remote Debugging package and extract the xdebug.so from the 5.2 directory, and move it to /usr/libexec/xdebug.so
Now open your php.ini file at /private/etc/apache2/php.ini and add this line:
[xdebug]
zend_extension=/usr/libexec/xdebug.so
Now, restart apache again with sudo apachectl restart, and you should have xdebug installed!
If not, or you come up with some errors, please comment and ill try to help.
Optionally, if you want to make local development a little bit easier you can follow my other tutorial: Making local development a little bit easier
| Print article | This entry was posted by Michel Hiemstra on August 19, 2009 at 4:03 pm, and is filed under How-To. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
