Installing PHP5 +apache2 using Macports on Leopard
I have had all sorts of fun and games trying to get php5 and apache2 installed on Leopard using macports. Six months ago I eventually gave up after lodging a ticket with macports.org no matter how hard I tried or what advise I followed it simply wouldn’t install. In the end my colleague Andrew tar’ed up his /opt folder and I copied that onto my machine and did a chown to my username/group and had a working php5 and apache2 install.
I had some problems yesterday getting yaz installed on ubuntu and decided to follow some instructions that Andrew gave me to install it on Leopard instead. I decided to bite the bullet and attempt to do a pure PHP5 apache2 install under macports again, and then use port to install php-yaz. Suffice to say that I ran into similar problems to those I encountered six months ago.
However after persevering I managed to get it all installed what follows is a summary of how I got it to work, in case anyone else out there ( and judging by the board posts that’s lots of you) is still struggling, or waiting for Macports 1.7.0 to be released.
-
-
# first install macports 1.6.0 download it from:
-
# http://svn.macports.org/repository/macports/downloads/MacPorts-1.6.0/MacPorts-1.6.0-10.5-Leopard.dmg
-
-
# check port is installed ok , port version should be correct
-
-
sudo port version
-
-
# do a self update and a sync
-
-
sudo port selfupdate
-
sudo port sync
-
-
# you have to install gawk, gmake and nawk before proceeding
-
-
sudo port install gawk
-
sudo port install gmake
-
sudo port install nawk
-
-
# now attempt to install php5 +apache2 and mysql
-
# you seem to have to install it with mysql or it will fail regardless.
-
-
sudo port install php5 +apache2 +mysql5 +server
-
-
# the above step will still fail (or did for me)
-
# it fails during msyql5 install, so clean and install TK
-
# then retry just mysql
-
-
sudo port clean mysql5
-
sudo port install TK
-
sudo port install mysql5 +server
-
-
#once this succeeds run the original command again
-
-
sudo port install php5 +apache2 +mysql5 +server
-
-
# this should now go all the way through and work
-
Once it is done follow the original instructions here.
This is so convoluted!! I hope the Macports folks sort this out. Even the ticket I raised didn’t specify the steps I took as a fix, and I basically stumbled onto them through trial and error. If anyone has a better explanation for why this worked then please let me know. Otherwise I hope it helps anyone else experiencing the same difficulties.
apache2, Mac, macports, PHP, Talis
For anyone having problems fetching nawk, there is a mirror site where you can grab it:
http://www.cs.princeton.edu/~bwk/btl.mirror/new/awk.tar.gz
but to save you a couple of seconds, here is a link to v20070501:
http://www.cs.princeton.edu/~bwk/btl.mirror/new/awk.tar.gz
Comment by Michal — October 12, 2008 @ 1:38 pm
[...] http://www.virtualchaos.co.uk/blog/2008/08/23/installing-php5-apache2-using-macports-on-leopard/ [...]
Pingback by Developing web applications locally on your Mac OSX using MacPorts :: Jaisen Mathai — December 9, 2008 @ 9:01 am