Home  >  Article  >  Backend Development  >  How to install and configure php Opcache

How to install and configure php Opcache

怪我咯
怪我咯Original
2017-07-13 09:55:002713browse

OPcache Improves the performance of PHP by storing the precompiled bytecode of PHP scripts in shared memory. The advantage of storing precompiled bytecode is that it eliminates the need to load and parse the PHP script each time. s expenses.

OPcache extension has been bundled in PHP 5.5.0 and subsequent versions. For PHP 5.2, 5.3 and 5.4 versions you can use the OPcache library in the PECL[2] extension.

This article mainly introduces the installation and configuration methods of PHP Opcache. The installation of Opcache requires adding enable-opcache during compilation. This article focuses on explaining Configuration method, friends who need it can refer to it

This article is for advanced versions such as PHP5.5. You need to add the --enable-opcache parameter when compiling

After the compilation and installation are completed, we Start configuring Opcache

[Opcache]
zend_extension = opcache.so
opcache.enable=1
opcache.memory_consumption = 64
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 4000
opcache.revalidate_freq = 60
opcache.fast_shutdown = 1
opcache.enable_cli = 1

Restart PHP-FPM after modification

service php-fpm restart

Last picture


The above is the detailed content of How to install and configure php Opcache. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn