Forget about Google’s hosted libraries and say hello to CDNJS. I can’t believe I’ve only now found out about this!

Elevator pitch:

  • Has servers in Australia wheres Google doesn’t, so latency is an order of magnitude faster
  • Has tonnes of javascript, css and other frontend libraries – much larger selection than google
  • List of libraries is community managed via github

Those are pretty much the key points. Read more here, and it’s located at

My own testing confirms the massive latency benefit over Google – just check out this download of jQuery, 0.9 seconds for Google versus 0.06 seconds from CDNJS. That’s a crazy big difference!

If you’re supplying Australian customers, you would be mad not to use it.

Running PHP through PHP-FPM with Apache 2.2

Running PHP through PHP-FPM is pretty easy in Apache 2.4 (or Nginx for that matter) with ProxyPass, however Apache 2.2 has no built-in convenient way to do it.

There’s a number of solutions that exist to accomplish this, but it seems that the ambiguously named mod_fastcgi.c is the least bad. One of the biggest issues I ran into while setting it up, was allowing for multiple fpm pools for the different virtual hosts, and the specific set of configurations that I’ve figured out allowed me to do this quite easily.

There’s are number of intricate things which must be done to get it working correctly, and while I hope that I nor anyone else ever has to do this again – let’s face the bleak reality, it’s not entirely unlikely that we will… so here’s how we get it going;

  1. Download and compile (yep) the apache module from their website. I’ll spare the installation instructions since they are described in detail in the module files. Ensure you have the httpd-devel or equivalent package installed before commencing.
  2. In your httpd.conf, surround the configuration include directives with the following code:

  3. Inside your virtual host definition file, but before and outside of the definition itself, define the fpm server like so:

  4. Then define it’s use inside the virtual host definition:

Hopefully those configurations are all that you need. As always, different pools will require different names (in this case mine is called prod) and ports. Also note the directories, and ensure they exist – particularly /var/lib/php-fpm and /var/lib/httpd/fasicgi .