4

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.

edigu
  • 9,878
  • 5
  • 57
  • 80
Flasz
  • 185
  • 1
  • 2
  • 12

2 Answers2

15

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.

edigu
  • 9,878
  • 5
  • 57
  • 80
  • According to [PECL documentation](http://pecl.php.net/package/ZendOpcache), PHP 5.2.* is also supported. – R.P Nov 26 '14 at 22:36
  • 1
    I have installed `Drupal` on `PHP 7.3.1` environment, and it did ask for `opcache` extension to be installed, but there seems to be NOT any new version of `opcache` out there, nothing for `PHP 7.3.1`, so, am I mistaken, or is `Drupal` asking for the impossible? – Top-Master May 19 '19 at 03:49
0

In addition to @edigu's answer, here are some additional considerations for Windows Server 2012R2/IIS 8+ users. PHP version is 7.2. I'm using the old Codeplex version of PHP Manager, so perhaps these steps don't apply if you're using the recently revamped version.

  • Enabling php_opcache.dll in the extensions GUI doesn't work. In php.ini, find the line that says extension=php_opcache.dll rename it to zend_extension=php_opcache.dll.
  • Find every line that begins with opcache. and make sure it isn't commented out.
  • In addition to the On and Off values for toggling properties, such as in opcache.enable=On, you can also use 1 and 0 respectively.

Restart the site in IIS, then the Zend OPcache section on the phpinfo() screen should report everything up and running.

Jacob Stamm
  • 1,660
  • 1
  • 29
  • 53