search
HomeBackend DevelopmentPHP7php7 installation guide (windows) opening zend opcache


What is zend opcache?

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 codes that can be run directly, also called operation codes (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!

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.

Open opcahe

Modify php.ini search: "[opcache]"

Add the following code (or change it on the original basis):

zend_extension = php_opcache.dll
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.max_accelerated_files=2000

Description of the functions of several important parameters:

opcache.enable=1 //开启opcache
opcache.enable_cli=1 //是否在CLI(即命令行时)启用opcache
opcache.memory_consumption=128 //共享内存的大下 可以根据项目大小和服务器配置自行调整
opcache.max_accelerated_files=2000//最大缓存文件个数

After setting, just restart apache. Open phpinfo and observe the changes:

php7 installation guide (windows) opening zend opcache

# proves that zend opcache has been successfully opened. After testing, the effect is obvious (because the number of compilations is reduced and the disk IO overhead is reduced), it is highly recommended that everyone turn it on.

Related recommendations: "PHP7 Tutorial"


##

The above is the detailed content of php7 installation guide (windows) opening zend opcache. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:hcoder. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software