CloudFlare mod_cloudflare WHM EasyApache4 CloudLinux Cannot load modules/mod_cloudflare.so

CloudFlare EasyApache4 Problems

Being a CloudFlare certified partner, all of my servers are running with CloudFlare WHM/cPanel plugin installed, as well as Railgun, but after upgrading one of my CentOS 6.9 servers to use EasyApache4, the real visitor IP was no longer showing in the access and error logs (CloudFlare IP was showing), and when attempting to restart Apache2 (httpd) I kept getting the “undefined symbol: ap_log_rerror” error, which CloudFlare and cPanel, were not very helpful at all in figuring out the problem … but I was able to figure it out, and here’s how to fix it

This was the error I kept constantly seeing whenever I would run  service httpd configtest :

Specifically the error being  mod_cloudflare.so: undefined symbol: ap_log_rerror

Others have reported errors similar to this, which is really just a different module directory:

I couldn’t for the life of me figure out what was causing this.  I followed all the instructions to install the CloudFlare plugin for WHM/cPanel, and it even showed the mod_cloudflare module under the EasyApache4 modules list.

Luckily enough I found a forum post on CloudFlare’s website, and it turns out, that the cloudflare.conf file still remained from before the EasyApache4 upgrade, and in order to get mod_cloudflare working correct, I needed to run a few commands on the server.

First, you need to make sure that ea-apache24-devel is installed on the server, which can be done by running this command (this MUST be installed!):

After you have installed that package, we build the module manually, by running these commands:

And that’s it!  The apxs command will build and install the module for you, and then all you need to do is to check to make sure the config passes, and then you can restart Apache:

If you get some warnings that look like this:

Chances are you still have old module configurations in either the old  /etc/httpd/  directory, or somewhere else that is already loading the module.  To find out where this is defined, you can run this command:

grep cloudflare -rI /etc/apache2/*

Make sure to check the /etc/httpd directory as well:

Voila! Profit!

Myles

Orlando, FL

Did this post help you?

Give back and rate it for me!

Related Posts

  • Sanjay Narayan

    Hello… I see this is posted in 2017. Is this the only method available even today?