mod_jrun on Apache 2.4 (Ubuntu 14.04 + ColdFusion 9)

After updating my ColdFusion 9 development machine from Apache 2.2 to version 2.4, Apache simply refused to come back up. The root cause of this was the mod_jrun22 module complaining about a missing symbol. After some Googling, I found others complaining about the same issue, however no-one had apparently tried to get mod_jrun to compile for Apache 2.4. So, here goes..

First, let’s assume we’re on a fresh Ubuntu 14.04 machine. Perform an apt-get update / upgrade, and then install some dependencies.

apt-get update && apt-get -y upgrade & apt-get -y install apache2 apache2-dev build-essential unzip

We’ve uploaded our ColdFusion 9 installer into the root directory. Let’s make it executable, and proceed to run it..

chmod +x ColdFusion_9_WWEJ_linux64.bin
./ColdFusion_9_WWEJ_linux64.bin

Proceed through the installation process, going with default values for the configuration, up until choosing the Apache Configuration Path. We need to create a file called ‘httpd.conf’ in the ‘/etc/apache2′ directory, just so that the installer can continue on its merry way.

touch /etc/apache2/httpd.conf

Specify the configuration path as /etc/apache2. The Binary File Path should be /usr/sbin/apache2, and the Control File should be /usr/sbin/apache2ctl.

Provide the root directory as /var/www/html. The runtime user should be www-data. Follow the rest of the installation task, until you are kicked back out to the shell.

Once ColdFusion has started up for the first time, we need to move the auto-generated directives from the httpd.conf file, to the apache2.conf file

cat /etc/apache2/httpd.conf >> /etc/apache2/apache2.conf

Now, we restart Apache2.

service apache2 restart
apache2: Syntax error on line 224 of /etc/apache2/apache2.conf: Cannot load /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.so into server: /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.so: undefined symbol: ap_log_error

So, this is the error that many people have run up against. We’re going to recompile the mod_jrun Apache module, so that it works with Apache 2.4.

mkdir /opt/wsconfig
cp /opt/coldfusion9/runtime/lib/wsconfig.jar /opt/wsconfig
cd /opt/wsconfig
unzip wsconfig.jar
cd connectors/src
cp mod_jrun22.c mod_jrun24.c
sed -i 's/remote_addr/client_addr/g' mod_jrun24.c
apxs -ic -n jrun mod_jrun24.c jrun_maptable_impl.c jrun_property.c jrun_session.c platform.c jrun_mutex.c jrun_proxy.c jrun_utils.c
mv /usr/lib/apache2/modules/mod_jrun24.so /opt/coldfusion9/runtime/lib/wsconfig/1/
find /etc/apache2 -type f -exec sed -i 's/mod_jrun22/mod_jrun24/g' {} +
service apache2 restart

If all went well, Apache 2 should now come back up, with the recompiled mod_jrun module. You can check to see if this worked by visiting the ColdFusion Administrator Panel (http:///CFIDE/administrator/)

There you have it – ColdFusion 9, not only running on Ubuntu 14.04, but running on the most recent version of Apache.

So, what was causing the error in the first place? Firstly the module itself needed to be compiled against the Apache 2.4 sources, and secondly the name of a structure element (in the request_rec->connection structure) changed from remote_addr to client_addr. This second issue was preventing the module from compiling, until we updated the element name to match the request_rec structure definition in Apache 2.4.