Zend OpCache in PHP 5.5 compatibilty?

Piwik 1.12
Web Server : IIS 7.5 on Windows Server 2008 R2 SP1
PHP 5.5.2 & MySQL 5.6.13

I updated my PHP today from 5.4.18 to 5.5.2 and everything was ok with my piwik website. Then I enabled Zend OpCache (now included in PHP 5.5 core) using "zend_extension=php_opcache.dll” et “opcache.enable=1” in the php.ini file. And now I have an Application Error in my Windows event log and my piwik Dashboard is not available. I don’t have any problem with my regular websites, only piwik dashboard is broken.

Faulting application nam : php-cgi.exe, version :, horodatage : 0x5213f894
Faulting module name : php5.dll, version :, horodatage : 0x52140684
Exception code : 0xc0000005
Fault offset : 0x00030012
Faulting application path : E:\PHP\php-cgi.exe
Faulting module path : E:\PHP\php5.dll

If a disable Zend OpCache in php.ini (opcache.enable=0), piwik dashboard is back.

I think there is an incompatibility between piwik and php 5.5 when using the opcode cache feature now in php core.

I’m glad to see that I’m not the only one with this problem as a ticket has been reported before, even if I don’t understand why it has been marked as closed. http://dev.piwik.org/trac/ticket/4093

By the way, I’ve found a way to enable Zend Opcache feature of PHP 5.5 without breaking Piwik dashboard.

In my php.ini, I add a [HOST=] directive to disable Zend Opcache only for my piwik website. This way zend caching is still enabled for my regular websites.

; Determines if Zend OPCache is enabled



I would like to point out that there have been talked on the PHP mailing list and here what someone have to say:

Could you try to add a function_exists check to

This at the function declaration of _json_encode:
if (!function_exists(’_json_encode’)) { function _json_encode($var, …

And a extra } at the end.

This seemed to correct this fatal error on my side:

[02-Sep-2013 10:35:40 Europe/Paris] PHP Fatal error: Cannot redeclare
_json_encode() (previously declared in
/usr/local/lib/php/share/piwik/libs/upgradephp/upgrade.php:109) in
/usr/local/lib/php/share/piwik/libs/upgradephp/upgrade.php on line 109

I do not know what opcache has to do with it, although I suspect that
Piwik is calling itself a lot of times and that opcache is trailing
behind (or something like that).

There this:

This patch, together with upgrading to the latest OPcache from github
solved my segfaults and fatal errors.

Source: [PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik and [PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

Thanks for the report. The bug is tracked at: Segfault with PHP 5.5.2 opcache · Issue #4093 · matomo-org/matomo · GitHub

if you have more info please post in ticket directly

Should the bug’s status be changed? I changed it from closed to reopened and robocoder changed it to wontfix.

Is this really a bug in Piwik or a bug in opcache? Can we “fix” anything in piwik or is the fix to update opcache to latest version?

Has the fixed version of opcache been released? If so, in what version is it included? I can’t test the fix until it is released so I’m not sure if the upgrade.php Piwik patch is necessary yet.

I have the same problem with a fresh new install on Windows Server 2012 with PHP 5.5.3.
Accès to Piwik main page get a 500 error code and an APPCRASH is reported in Windows eventlog.
In ticket Piwik not compatible with PHP 5.5 new core feature · Issue #4111 · matomo-org/matomo · GitHub a piwik dev (Anthon Pang) said it’s a bug in PHP.
I search for same problem in php forum but found nothing about this bug. Can Anthon gives us the link he saw about the PHP bug so we can add comments in it and know when it will be fixed.

I’ve found the ref of the PHP bug : #65510 (5.5.2 crashes in _get_zval_ptr_ptr_var)
The fix has been inluded in PHP 5.5.4RC1. Just tried today and Piwik dashboard is now ok. No more AppCrash.

I also had the same problem with nginx and php 5.5.3 (Debian Wheezy) and disabling the opcache for just the piwik site worked perfectly.

You actually don’t have to totally disable opcache. opcache.optimization_level=0 in php.ini will fix it.