Monday, 27 July 2015

PHP as fastcgi connection timing out with apache2

Lately I have been trying to test a WordPress plugin I have been working on. Unfortunately I couldn't test it on my live server, as the build software on the webserver was too out of date to build the GeoIP apache module I needed to test with.

I thought oh well, I can at least partially test it in my local dev environment. But after getting that all set up, I kept getting timeouts when connecting to the dev site (PHP wasn't responding in time).

I tried installing the latest PHP (7 beta 2), which took about a day. (No point building the latest version of PHP without also building the latest version of its dependencies). But still the same issue!

I tried playing around with the php.ini settings, running apache with nginx off, etc. various things to try and debug the issue. Eventually I found the issue. For my PHP proxy in the Apache config I had:

<Proxy fcgi://localhost/ enablereuse=on max=10>

I had copied this from a page on setting up apache with PHP running as fastcgi. I didn't know what the enablereuse=on max=10 bits actually meant. I removed them, and now it seems to be working fine.

Now I can get on with the actual testing / debugging of my script!

No comments: