Upgrading to Apache 2.4 with Macports

The 2.4 branch of Apache has been available since February 12, but not available at Macports, which still defaults to versions 2.2.  Apache can be installed using the apache24 port, but connecting it to php55 calls in Apache 2.2, which isn’t what you’re after.

This can be fixed with a port patch, as the problem is merely one of dependencies, not actual compatibility.  This patch  from the Macports bug list adds a new port php55-apache24handler, which is the code between PHP55 and the Apache 2.4 daemon, as the name suggests.

What isn’t necessarily clear I’ve explained here:

1. Where are portfiles?

They’re in /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports

where “/opt/local” is the default installation directory for Macports, which will be different only if you’ve installed it to a different place.

2.  What are these portfiles?

Within the …/release/tarballs/ports directory are about 45 subfolders indicating the categories of ports.  Inside those folders are subfolders to find specific ports, although the categorization is not always what you would think.  For example, there’s a ‘lang/php’ as well as a ‘php’.

A portfile is always named Portfile.

3.  What is a subport?

This isn’t actually documented in the user documentation, but a “subport” is a port provided by a portfile with an extension name after a hyphen.  php55-apache2handler provides the subport apache2handler.

4.  Why I can’t find I find the php55 Portfile?

A single Portfile can and often does provide multiple ports, as well as one or more subports.  In this case, ‘php/Portfile’ provides a whole mess of ports, including the whole php series and many of its subports.  You can see this in the Portfile with references to “subports” in the Portfile, as well as the “PortGroup” instructions near the top, which include other port files.

5.  Why doesn’t altering the Portfile Seem to do Anything?

The entire system is cached with an index system.  cd to the “top level” of the ports tree at:

/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports

> portindex

will regenerate the PortIndex and PortIndex.quick files you see there, and allow your port system to see any changes you’ve made.

6. What happened to mod_wsgi?

The mod_wsgi for interfacing to Python, should you want to do that, is still tied to Apache 2.2 in MacPorts.

 

The release schedule for 2.4 (thanks, Apachehaus.com!) is:

2.4.10 : July 19, 2014
2.4.9 : March 16, 2014
2.4.8 : Not Released
2.4.7 : Released November 25, 2013
2.4.6 : Released July 22, 2013
2.4.5 : Not released
2.4.4 : Released Feb 25, 2013
2.4.3 : Released Aug 18, 2012
2.4.2 : Released April 17, 2012
2.4.1 : Released February 17, 2012

Apache’s guide to doing the upgrade is here:

http://httpd.apache.org/docs/2.4/upgrading.html