Instructions for Zend OPCache to accelerate PHP

Source: Internet
Author: User
Tags phpinfo zts zend

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

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.