Zend Opcache configuration method
Zend Opcache has been integrated into PHP 5.5. When compiling and installing PHP5.5, add -- enable-opcache. But it also supports earlier versions of PHP 5. 2. *, 5. 3. *, 5. 4. * in the future, the 5.2 support will be canceled. The following is my installation method in PHP 5.4:
Execute the following commands in sequence
The code is as follows: |
Copy code |
Wget http://pecl.php.net/get/zendopcache-7.0.2.tgz Tar xzf zendopcache-7.0.2.tgz Cd zendopcache-7.0.2 Phpize |
If you cannot find phpize, you can find the PHP path on your own. My php path is/usr/local/php/bin/phpize. In the following line, you need to modify it according to your PHP. ini path.
The code is as follows: |
Copy code |
./Configure -- with-php-config =/usr/local/php/bin/php-config Make Make install |
If Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-zts-20100525/is displayed/
Indicates that the installation is complete. Modify the php configuration file to make it take effect.
Add the following lines at the end of php. ini:
The code is as follows: |
Copy code |
Zend_extension =/usr/local/php/lib/php/extensions/no-debug-zts-20100525/opcache. so Opcache. memory_consumption = 128 Opcache. interned_strings_buffer = 8 Opcache. max_accelerated_files = 4000 Opcache. revalidate_freq = 60 Opcache. fast_shutdown = 1 Opcache. enable_cli = 1 |
128 means to allocate MB of memory to it, restart apache, and use phpinfo to check whether it has taken effect. The following information indicates that it has taken effect.
Whether Zend Opcache takes effect
You can use phpinfo to check whether the configuration takes effect. The following figure shows my PHP Extension configuration:
Zend Opcache has taken effect. If not, see the same solution.
It is relatively simple to configure OPC. I have killed the eAccelerator and repeated the functions. The configuration is as follows:
The code is as follows: |
Copy code |
Wget http://pecl.php.net/get/zendopcache-7.0.2.tgz Tar xzf zendopcache-7.0.2.tgz Cd zendopcache-7.0.2 /Usr/local/php/bin/phpize ./Configure -- with-php-config =/usr/local/php/bin/php-config Make |
Make install, configure php. ini, and add:
[Opcache]
The code is as follows: |
Copy code |
Zend_extension = opcache. so Opcache. memory_consumption = 128 Opcache. interned_strings_buffer = 8 Opcache. max_accelerated_files = 4000 Opcache. revalidate_freq = 60 Opcache. fast_shutdown = 1 Opcache. enable_cli = 1 Opcache. enable = 1 |
In general, based on past experience, if it is added before ZendGuardLoader, it will be more stable