Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows, XAMPP, PHP 7 and opcache

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 ;).

like image 630
Jazi Avatar asked Dec 07 '16 22:12

Jazi


Video Answer


3 Answers

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.
like image 99
Key Shang Avatar answered Oct 13 '22 04:10

Key Shang


open a php.ini file

  1. Change the ;opcache.enable=1 to opcache.enable=1
  2. Add opcache dll path at the end of the file zend_extension = "C:\xampp\php\ext\php_opcache.dll"
  3. Restart apache

for more reference check this video https://www.youtube.com/watch?v=GvWrNoRDjUY

like image 42
Kailas Avatar answered Oct 13 '22 04:10

Kailas


In case of Xampp, just put the below lines next to [opcache]

zend_extension="C:\xampp\php\ext\php_opcache.dll"
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
like image 2
Wasim Khan Avatar answered Oct 13 '22 06:10

Wasim Khan