Installing PHP5 +apache2 using Macports on Leopard

nadeem.shabir | | Saturday, August 23rd, 2008

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.

  1.  
  2. # first install macports 1.6.0 download it from:
  3. # http://svn.macports.org/repository/macports/downloads/MacPorts-1.6.0/MacPorts-1.6.0-10.5-Leopard.dmg
  4.  
  5. # check port is installed ok , port version should be correct
  6.  
  7. sudo port version
  8.  
  9. # do a self update and a sync
  10.  
  11. sudo port selfupdate
  12. sudo port sync
  13.  
  14. # you have to install gawk, gmake and nawk before proceeding
  15.  
  16. sudo port install gawk
  17. sudo port install gmake
  18. sudo port install nawk
  19.  
  20. # now attempt to install php5 +apache2 and mysql
  21. # you seem to have to install it with mysql or it will fail regardless.
  22.  
  23. sudo port install php5 +apache2 +mysql5 +server
  24.  
  25. # the above step will still fail (or did for me)
  26. # it fails during msyql5 install, so clean and install TK
  27. # then retry just mysql
  28.  
  29. sudo port clean mysql5
  30. sudo port install TK
  31. sudo port install mysql5 +server
  32.  
  33. #once this succeeds run the original command again
  34.  
  35. sudo port install php5 +apache2 +mysql5 +server
  36.  
  37. # this should now go all the way through and work
  38.  

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.

, , , ,

Powered by WordPress | Theme by Roy Tanck