Windows, XAMPP, PHP 7 and opcache

Krzysztof Trzos picture Krzysztof Trzos · Dec 7, 2016 · Viewed 21.3k times · Source

I've installed latest XAMPP server with PHP 7 (update: checked also PHP 7.1) (on my Windows 10 system). Wanted to use opcache, so I enabled it in php.ini.

[opcache]
zend_extension=php_opcache.dll
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000

With that change now, and with almost every page refresh, I'm getting this error from Apache:

AH00428: Parent: child process 3748 exited with status 3221226356 -- Restarting.

So, page is loading, and loading... waiting to Apache start again. When I'm turning opcache off (by setting opcache.enable=0), Apache is not restarting and everything works fine (omitting the slower web application topic, of course).

Everything works fine while loading app on XAMPP having PHP 5.6 with enabled opcache.

EDIT (added GIF image):
As you can see, sometimes page refreshes like it should. But sometimes it's refreshing much longer, and Apache is restarting in that moment.

enter image description here

EDIT:
To be honest, I gave up with this application and working with PHP on Windows (was working on it for around 10 years with PHP <= 5.6). It's very hard/impossible (for now) to make PHP 7.x work on that OS (with Opcache). Decided to go with Ubuntu and server created with Docker. Everything is easier to configure (especially with Docker) and works faster. I advise everyone to do the same ;).

Answer

Key Shang picture Key Shang · Jul 26, 2017

Your php_opcache.dll path seems wrong, you need write it like below, it works for me.

[opcache]
zend_extension=C:\xampp\php\ext\php_opcache.dll
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=256
opcache.max_accelerated_files=2000

More details

If your XAMPP comes with PHP 5.5+ by default, opcache already included in the bundle, you will just need to enable it. To enable the extension:

  1. Open php.ini (by default it should be located here: C:\xampp\php\php.ini).

  2. Add this line at the end of the file: zend_extension=C:\xampp\php\ext\php_opcache.dll

  3. Restart Apache server.