New MacBook - How to setup Apache, PHP and MySQL

After 3 years with my old Imac, I have finally bought a new MacBook. The screen is tiny, but I guess I will get used to it. I am very exicted, but before any real joy can begin, I need to install all the thing I need for my use as “Webdesigner/Webdeveloper”.
Apache 2
In /etc/apache2/httpd.conf add this line underneath the LoadModule line for PHP (it’s commented out by default).
#LoadModule php5_module libexec/apache2/libphp5.so<br>LoadModule php5_module /usr/local/php5/libphp5.so
Update your user’s Apache configuration:
Change /etc/apache2/users/<username>.conf to something like this:
<Directory "/Users/gerhard/Sites/"><br> Options Indexes FollowSymLinks MultiViews<br> AllowOverride All<br> Order allow,deny<br> Allow from all<br></Directory>
PHP Version 5.2.5
Leopard is shipping with PHP 5, but its not compiled with GD. I found this great solution that doesn’t needs to be build locally.
Switch to Entropy’s PHP distribution
# move the default php5 installation<br>sudo mv /usr/local/php5 ~/Desktop/php5.old<br># download the Entropy version and unpack it<br>curl -O http://www2.entropy.ch/download/php5-5.2.5-6-beta.tar.gz<br>tar -xzf php5-*-beta.tar.gz<br># Move the entrophy version where the old version was located<br>sudo mv php5 /usr/local/<br># Create a symbolic link<br>sudo ln -sf /usr/local/php5/entropy-php.conf /etc/apache2/other/+entropy-php.conf<br># Restart apache<br>sudo apachectl restart
Enable MySQL in php.ini:
# Copy the default php.ini.default file to php.ini<br>sudo cp /etc/php.ini.default /etc/php.ini<br># Search for "mysql.default_socket" and make it look like this:<br>mysql.default_socket = /tmp/mysql.sock
MySQL
Download Tiger package from MySQL (it works in Leopard to), and install this package. Put the “MySQL.prefPane” into your “Library/PreferencePanes/” folder, it will give you a simple way to start and stop the MySQL server inside System Preferences. MySQL is know installed in “/usr/local/mysql” and the socket resident in “/tmp/mysql.sock”.
MacPorts – a easy way to install gd2 and ImageMagick
Before you can install MacPorts you need to install Apple’s Developer Tools, which you will find on your “Mac OS X Install Disc 2”. Once MacPorts is installed you can open Terminal.app to install gd2 and ImageMagick.
# Install gd2 as root-user (This will take some minutes)<br>sudo port install gd2<br># Install ImageMagick as root-user (Time..)<br>sudo port install ImageMagick
Update your Shell PATH
To ensure that the new software is your Shell PATH variable used in Terminal.app. Update your “~/.bash_profil” with these lines:
export PATH="/Developer/Actionscript3:/Developer/SDKs/flex_sdk/bin: /Developer/SDKs/air_sdk/bin:/usr/local/bin:/usr/local/sbin: /usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:$PATH"<br>export MANPATH="/opt/local/share/man:$MANPATH"
Flash, Flex and Adobe Air
I keep Adobe Air SDK and Flex SDK in inside “/Developer/SDKs/” folder. Download these form Adobe.com.
ActionScript 3 classes I keep in “/Developer/Actionscript3/”
Summary
You should know have a running enviroment for web developing on your fresh Leopard Install. Among the other regular apps I have installed on my new MacBook are these:
Firefox 3, TextMate, RBrowser, Quicksilver, Twhirl (Adobe Air app), Adobe CS 3 Suite.