How to use ZendOpcache to accelerate PHP and zendopcache_PHP

Source: Internet
Author: User
Tags apc
Use ZendOpcache to accelerate PHP and zendopcache. Using ZendOpcache to accelerate PHP, zendopcacheOptimizer + is a closed source developed by Zend but can be used free of charge to optimize and accelerate PHP components. it is the first and fastest opcode cache tool. Zend Opcache is used to accelerate PHP and zendopcache

Optimizer + is a closed-source PHP optimization acceleration component developed by Zend but available for free. it is the first and fastest opcode cache tool. Now Zend technology company has turned Optimizer + into Zend Opcache open-source under PHP License.

Zend OPcache provides faster PHP execution process through opcode caching and optimization. It stores pre-compiled script files in the shared memory for future use, thus avoiding the time consumption of reading code from the disk and compiling. At the same time, it also applies some code optimization modes to make code execution faster.

1. what is opcode cache?

After analyzing the script Code, the interpreter generates intermediate Code that can be run directly, also known as the Operate Code (opcode ). Opcode cache is designed to avoid repeated compilation and reduce CPU and memory overhead. If the performance bottleneck of dynamic content does not lie in CPU and memory, but in I/O operations, such as disk I/O overhead caused by database queries, the performance improvement of opcode cache is very limited. However, since opcode cache can reduce CPU and memory overhead, it is always a good thing-in line with the environmental attitude, should we minimize the consumption? : D

The modern opcode cache (Optimizer +, APC2.0 +, and others) uses shared memory for storage and can directly execute files from it, instead of "deserialization" code before execution. This will lead to significant performance acceleration, which usually reduces the overall server memory consumption and has few disadvantages.

2. Advantages and disadvantages of Optimizer + and APC

Optimizer + was renamed Opcache in middle March 2013.

According to the discussion on PHP wiki, Zend Opcache will be integrated into php 5.5. As a competitor of APC, Zend Opcache is likely to replace APC, although OptimizerPlus does not have the user cache function like APC.

Advantages of OPTIMIZER + relative APC
Advantages of APC over OPTIMIZER +
3. use Zend Opcode

Now you can use Zend Opcache to replace 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 edition. However, the support for PHP 5.2 will be canceled 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.

Install and configure from source code

The source code of Zend Opcache is hosted on github. it is still called ZendOptimizerPlus.

For installation steps, see The README file.

Note:

By the way, php-devel is required for source code compilation and installation. In README, quick installation is used at the beginning of the section,

$PHP_DIR/bin/phpize

If you do not know the phpize path, you can,

whereis phpize

The recommended optimization settings are also available in the README file.

Install and configure from EPEL source

I do not like to compile and install programs from the source code. one is limited in level, and the other is afraid of trouble. The following describes how to install Zend Opcache from the EPEL installation source. the operations on CentOS are used as an example based on my VPS configuration.

The EPEL community already provides the Zend Opcache installation package, which can be directly installed using yum. Of course, the premise is that the EPEL installation source has been configured and used. If not, refer to here.

Please note that PHP on the REMI installation source is already version 5.4. Some people have tested that WordPress's performance on PHP 5.4 is better than that on PHP 5.3 (10% faster and lower ram consuming). By the way, upgrading PHP is not a bad thing.

Procedure:

Check to see if the startup is correct:

php -v

The output result is similar:

PHP 5.4.14 (cli) (built: Apr 11 2013 11:04:35) Copyright (c) 1997-2013 The PHP GroupZend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies with Zend OPcache v7.0.1, copyright (c) 1999-2013, by Zend Technologies


Original article reproduced in: http://cnzhx.net/blog/zendopcache-accelerate-php/Thanks to the original article

Zend Opcache accelerates PHP. zendopcache Optimizer + is a closed source developed by Zend but can be used free of charge to optimize and accelerate PHP components. it is the first and fastest opcode cache tool. Now...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.