Installing Apache, PHP, MySQL on my Macbook Pro

I am used to installing these on CentOS.  I did it so many times, I just wrote a script to do it. Simple! However with Mac OSX and MacPorts, I was having trouble. I installed MacPorts and then ran through the installers for Apache2, PHP5, and MySQL5 (including the MySQL server) Set up my http conf file with virtual hosts and this is where everything stopped.  I could not get a page to load, and if I did get one to load it would not connect to MySQL. The problem was my mysql socket. So I made this change:

/opt/local/var/run/mysql5/mysqld.sock

Then, sessions wouldn't work, so I had to do two things:
  1. Set the permissions of /private/tmp to 777
  2. Change the php.ini setting for session.save_path to "/private/tmp"
Once these were done, I was able to load a page and connect to MySQL.