Optimizer is a closed-source but free-to-use PHP optimization acceleration component developed by Zend. It is the first and fastest opcode caching tool. . Now, Zend Technologies has open sourced Optimizer as Zend Opcache under the PHP License.
Zend OPcache provides faster PHP execution through opcode caching and optimization. It stores precompiled script files in shared memory for later use, thus avoiding the time consumption of reading code from disk and compiling it. At the same time, it also applies some code optimization modes to make the code execute faster.
When the interpreter completes the analysis of the script code, it generates intermediate code that can be run directly, also known as opcode (Operate Code, opcode). The purpose of Opcode cache is to avoid repeated compilation and reduce CPU and memory overhead. If the performance bottleneck of dynamic content lies not in CPU and memory, but in I/O operations, such as the disk I/O overhead caused by database queries, then the performance improvement of opcode cache is very limited. But since opcode cache can reduce CPU and memory overhead, this is always a good thing - in an environmentally friendly manner, consumption should be reduced as much as possible, right? :D
Modern opcode caches (Optimizer, APC2.0, others) use shared memory for storage and can execute files directly from them without having to "deserialize" the code before execution. This results in significant performance speedups, often lower overall server memory consumption, and few downsides.
Optimizer was renamed Opcache in mid-March 2013.
According to discussions on the PHP wiki, Zend Opcache is about to be integrated into php 5.5. As a competitor of APC, the new Zend Opcache is likely to replace APC's position, although OptimizerPlus does not have a user cache function like APC.
It is now possible to use Zend Opcache instead of APC as a PHP optimization acceleration tool. The current Zend Opcode is compatible with PHP 5.2.*, 5.3.*, 5.4.* and PHP-5.5 development version. However, support for PHP 5.2 will be removed in the future.
Note: Zend Opcache conflicts with eaccelerator. To install Zend Opcache, you may need to uninstall eaccelerator first - if you use this acceleration module.
The source code of Zend Opcache is hosted on github, and it is still called ZendOptimizerPlus.
For detailed installation steps, please refer to its README file.
Note:
By the way, php-devel is required when compiling and installing from source code. It is used at the beginning of the quick installation section in README,
$PHP_DIR/bin/phpize
If you don’t know the path of phpize, you can,
whereis phpize
There are also corresponding recommended optimization settings in the README file.
I don’t like to compile and install programs from source code. One is because of my limited skills, and the other is because I am afraid of trouble. The following describes how to install Zend Opcache from the EPEL installation source, taking the operation on CentOS as an example, based on the configuration of my VPS.
The EPEL community has provided an installation package for Zend Opcache, which can be installed directly using yum. Of course, the premise is that the EPEL installation source has been configured and used. If not, you can refer here.
As a reminder, the PHP on the REMI installation source is already version 5.4. Since some people have tested that WordPress performs better on PHP 5.4 than on PHP 5.3 (10% faster and lower ram consuming), it’s not a bad thing to upgrade PHP by the way.
Operation steps:
Check to see if it started correctly:
php -v
The output is similar to:
PHP 5.4.14 (cli) (built: Apr 11 2013 11:04:35) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies with Zend OPcache v7.0.1, Copyright (c) 1999-2013, by Zend Technologies<br /><br /><br /><span><strong><span>原文转载于:http://cnzhx.net/blog/zendopcache-accelerate-php</span></strong>/ 感谢原著</span>