How to install Zend OPcache Extension + PHP >= 5.4 on Windows

Flasz picture Flasz · Jun 11, 2014 · Viewed 32.9k times · Source

Is it possible to install Zend OPcache module for PHP 5.4.29 in Windows Environment? I have downloaded OPCache that was meant to be compatible with PHP 5.4 but

php -v

does not show anything new loaded.

Answer

edigu picture edigu · Jun 11, 2014

Zend OPcache extension is compatible with 5.3.* 5.4.* and PHP 5.5.*

You should download the source-code of the extension and compile yourself or try to download pre-compiled windows version here and call the extension in your php.ini like this:

zend_extension=/path/to/opcache.dll

Notice :

  1. There are multiple versions exists for windows binaries: Thread Safe and Non-Thread Safe. You should pick the correct one according your needs. Learn more about TS and NTS here.
  2. Each build has a php version in filename. In your case, you should use php_opcache-7.X.X-5.4-XX-XX-XXX.zip.

Update Since opcache is a part of php core for a long time and this question is highly visible on search engines, I wanted to update my answer.

According to documentation, enabling opcache using following lines in php.ini:

zend_extension=php_opcache.dll
opcache.enable=On
opcache.enable_cli=On

then restarting the web server (IIS I guess) should be enough.