- XAMPP is the quickest and easiest to setup a standard install of Apache, Mysql, and PHP. It also includes phpMyAdmin and a number of common modules already installed. You can download it here.
- The second option for installing LAMP is to use MacPorts. This takes much longer, but it will allow you to get the latest versions, keep them up to date and install custom modules into apache. Here is how to install it.
Install Guide for MacPorts.
Install XCode
- Download and Install XCode for your Mac. This is pretty simple and self explanatory, however it is over 3 gigs. Sit back, get a cup of Starbucks, and enjoy your favorite tech manual while you wait.
- Next Grab the MacPorts Source for which ever flavor of the Mac Operating System you are using. Lion, Snow Leopard, and Leopard are all three available here.
- Now simply update your macports by running this command in the Terminal:
sudo port -v selfupdate
Install MySQL and MySQL Server
1) Install mysql server
sudo port install mysql5-server-devel2) Make mysql run at startupsudo port load mysql5-server-devel3) Setting up mysqlsudo -u _mysql mysql_install_db54) Start mysql for the first timecd /opt/local ; sudo /opt/local/lib/mysql5/bin/mysqld_safe &5) Change the root password for mysql/opt/local/lib/mysql5/bin/mysqladmin -u root password 'MYPASSWORD'6) Add commands to profileecho "" >> ~/.profileecho "# MacPorts MySQL alias" >> ~/.profileecho "alias mysqlstart='sudo mysqld_safe5 &'" >> ~/.profileecho "alias mysqlstop='mysqladmin5 -u root -pr0xv83s shutdown'" >> ~/.profileecho "" >> ~/.profilesh ~/.profile
Install PHP and Apache
1) Install php and apache (all on 1 line)
sudo port install php5 php5-curl php5-gd php5-mbstring php5-mcrypt php5-memcache php5-mysql php5-openssl php5-soap php5-zip
2) Run apache at statup
sudo port load apache2
3) Add command to profile
echo "" >> ~/.profile
echo "# MacPorts Apache2 alias" >> ~/.profile
echo "alias apache2ctl='sudo /opt/local/apache2/bin/apachectl'" >> ~/.profile
echo "" >> ~/.profile
sh ~/.profile
4) Activate php in apache
cd /opt/local/apache2/modules;sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
5) Create phpinfo
sudo sh -c 'echo "" >> /opt/local/apache2/htdocs/phpinfo.php'
Setup memcached
1) run memcached at startup
sudo port load memcachedInstall GIT
1) install git
sudo port install git-core
And there you have it. Your home apache directory is now at:
/opt/local/apache2/htdocs
You will also have a number of commands ready to start/stop/restart apache and mysql. *be sure to log out of the terminal and log back in so they work*
apache2ctl stop
apache2ctl start
apache2ctl restart
mysqlstart
mysqlstop
I hope you enjoy your new setup. You can now read up on macports and learn how to keep all of your code current.