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.
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 ;).
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:
Open php.ini (by default it should be located here: C:\xampp\php\php.ini).
Add this line at the end of the file:
zend_extension=C:\xampp\php\ext\php_opcache.dll
Restart Apache server.
open a php.ini file
Change the ;opcache.enable=1 to opcache.enable=1
Add opcache dll path at the end of the file zend_extension = "C:\xampp\php\ext\php_opcache.dll"
Restart apache
for more reference check this video https://www.youtube.com/watch?v=GvWrNoRDjUY
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
To be honest - do not use xammp. Right now we have a bit better tech stack, to run PHP on Linux servers.
Docker
https://docs.docker.com/docker-for-windows/
Vagrant:
https://www.vagrantup.com/
Both of them are based on linux systems, where most of xammp problems will not have place.
First at all:
This is 2022 and I had a similar problem too with PHP-7.2, not on Xamp, but similar server.
How I've got my problem solved?
If you're here because of that, at first try to go with a default "opcache configuration options". And just above opcache.enable=1 put zend_extension=opcache. Your PHP is smart enough to find the extension. And yeah, there's no need to define the full path if you have defined it here extension_dir = [YOUR PATH] (in php.ini). Of course you can use the full path too, if you want too. The path, probably, it's not a problem if your extension is there (in the folder with all PHP extensions). Did you checked, is it there, your extension?
My problem was in this two options:
opcache.memory_consumption
opcache.interned_strings_buffer
I have no idea why, but I guess this two option should have some balance, because both of them is about memory usage.
So, this had my Apache useless, because it didn't wanted to start
opcache.memory_consumption = 64
opcache.interned_strings_buffer = 32 ;this one BAD
next one works fine!
opcache.memory_consumption = 64
opcache.interned_strings_buffer = 16
this one is works fine too!
opcache.memory_consumption = 128
opcache.interned_strings_buffer = 32
So, as I said, at first try to go with a default values of "opcache configuration options", and later do experiments.
How to check everything works on PHP?
var_dump ( zend_version() );
var_dump ( extension_loaded("opcache") ); // bool(false) cuz it's ZEND
var_dump ( extension_loaded("Zend OPcache") ); // bool(true)
// Next one will give you a lot of data about current opcache usage,
// but of course, only if your extension is enabled.
print_r ( opcache_get_status() );
Default OPcache configuration options you can find here:
https://www.php.net/manual/en/opcache.configuration.php
Creeating directory with appropriate permissions and setting it php.ini worked!
opcache.file_cache=d:\xampp\htdocs\opcache
ThreadStackSize 8388608
Helped me in the similar case. This is a httpd option.
on php.ini add more
zend_extension=opcache
remove comment
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=256
opcache.max_accelerated_files=10000
restart apache
After installing APC on a VPS with CentOS/Nginx/8G Ram, apc.php always shows uptime = 0 minutes, this is my apc configuration :
apc.enabled=1
apc.shm_size=512M
apc.num_files_hint=10000
apc.user_entries_hint=10000
apc.max_file_size=5M
apc.stat=0
apc.optimization=0
apc.shm_segments=1
apc.enable_cli=1
apc.cache_by_default=1
apc.include_once_override=1
I restared nginx afeter updating php.ini, the website seems to be faster than before, do you thing "uptime=0" is normal value ?
I am using WAMPSERVER on my windows.I have downloaded the APC and also APCU PHP extensions and enabled it.Now when I run my Symfony2 project I received error
Unable to use ApcUniversalClassLoader as APC is not enabled
in phpinfo it is showing like this block
and in my php.ini file I have a added following line of code
[APC]
;specifies the size for each shared memory segment 8MB to start
apc.shm_size=128M
;max amount of memory a script can occupy
apc.max_file_size=1M
apc.ttl=0
apc.gc_ttl=3600
; means we are always atomically editing the files
apc.file_update_protection=0
apc.enabled=1
apc.enable_cli=1
apc.cache_by_default=1
apc.include_once_override=0
apc.localcache=0
apc.localcache.size=512
apc.num_files_hint=1000
apc.report_autofilter=0
apc.rfc1867=0
apc.slam_defense=0
apc.stat=1
apc.stat_ctime=0
apc.ttl=7200
apc.user_entries_hint=4096
apc.user_ttl=7200
apc.write_lock=1
can someone tell me what I am missing?
Very new to Symfony so apologies if the answer is obvious. I am trying to add APC to a project to see if it improves performance. I am running symfony with easyphp on Windows 7/Windows 8 (installed on usb).
APC is installed in ext folder and added to php.ini file as:
extension=php_apc.dll
then at end of file:
[APC]
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 128M
apc.max_file_size = 5M
apc.stat = 1
php works fine with these settings. However when I now try to load my Symfony project I get the following error:
FatalErrorException: Compile Error: Cannot redeclare class
Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain in
F:\EasyPHP\data\localweb\projects\SymfonyProj\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain.php line 36
Not sure if I have my caching set up all wrong or I am missing some config options somewhere?
I have installed Symfony 2 and I have activated the opcache (ZendOPtimizer) extension and when I intent to generate the cache of a web page O've got this error :
Warning: filemtime(): stat failed for C:/Apache24/htdocs/symfony/app/cache/dev/annotations/Acme-DemoBundle-Controller-SecuredController.cache.php in C:\Apache24\htdocs\symfony\vendor\doctrine\common\lib\Doctrine\Common\Annotations\FileCacheReader.php line 97
This is my opcache config :
zend_extension="c:\php\ext\php_opcache.dll"
opcache.enable=1
opcache.use_cwd=0
opcache.validate_timestamps=0 ; file stat
opcache.revalidate_freq=2 ; seconds
opcache.revalidate_path=0
opcache.save_comments=0
opcache.load_comments=0
opcache.dups_fix=0
opcache.inherited_hack=0
opcache.log_verbosity_level=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.enable_file_override=1
opcache.max_wasted_percentage=5 ; percent waste until restart
opcache.consistency_checks=0
opcache.force_restart_timeout=180
opcache.blacklist_filename=paypal.php
opcache.fast_shutdown=1
opcache.optimization_level=0xffffffff
opcache.enable_slow_optimizations=1
opcache.max_file_size=0
When I disable this extension, the generation of the cache works
Versions :
Symfony 2.3.3
PHP 5.5
Apache 2.4.6 For Windows
I had exactly the same problem on my Mac, using the homebrew php55 version.
As mentioned in the Optimizer documentation, the option opcache.enable_file_override=1 may break some frameworks. It seems that is the case for Symfony2. Switching the value to 0 solved the problem.
1 - Make sure you have disabled APC or it'll create conflicts.
2 - Make sure you've restarted apache entirely after activating opcache.