Tempting Shortcuts
Working notes on the slower path

Notes > Tech > here

Using PHP

Notes on battling with PHP, lastest update on Feb 01, 2017.

PHP + opcache

I ran into an issue whereby turning ON the opcache on PHP 5.6 would result in blank screens and request failures in CiviCRM.

Turning it on, seemed to have sorted out civi - I can turn on the opcache and not get the failures.

But after a while that didn’t solve it seems :(

And the php-fpm process is throwing errors - “zend_mm_heap corrupted” and kill in the worker process.

More searching yielded this stack conversation. First answer was a maybe (but without rationale), but third one is worth a quick try.


The second pointed to the USE_ZEND_ALLOC=0 mentioned here and various PHP issues that speak about it.

Onto learning about PHP memory management and finding a note that you shouldn’t do what is suggested

More comments mentioned disabling GC settings

This was also suggested by this note to do the same.

Eventually I found two reports about Debian PHP packages that suggested it had been dealt with. But which packages? So I decided to install the packages from this alternate repository on to a dev server.

But it seems that my regular update to Debian and a restart has resolved the issue - none of this was needed :(

Nope, wrong again.

After hours of working fine, the worker processes are crashing again :( but only on one of the servers.

So I have run diff on the 3 config files from the servers. There are a couple of differences in them, based on testing some of the suggestions above, so they are noted, but shouldn’t be the issue.

And then I notices the php-fpm.conf has a difference in the events.mechanism - ‘epoll’ was set on the server that is crashing. After some reading up on the options I commented the setting to go back to the default - I presume it is poll(), but could be select().

Stable again.

Next up will be to migrate CiviCRM back off the dev server.

upgrading to ondrej-php