PHP optimization---opcache configuration instructions
<span>[</span><span>opcache</span><span>]</span><span> zend_extension </span>= "G:/PHP/php-5.5.6-Win32-VC11-x64/ext/php_opcache.dll" <span>;</span><span> Zend Optimizer + 的开关, 关闭时代码不再优化.</span> opcache.enable=1 <span>;</span><span> Determines if Zend OPCache is enabled for the CLI version of PHP</span> opcache.enable_cli=1 <span>;</span><span> Zend Optimizer + 共享内存的大小, 总共能够存储多少预编译的 PHP 代码(单位:MB)</span><span> ;</span><span> 推荐 128</span> opcache.memory_c <span>;</span><span> Zend Optimizer + 暂存池中字符串的占内存总量.(单位:MB)</span><span> ;</span><span> 推荐 8</span> opcache.interned_strings_buffer=4 <span>;</span><span> 最大缓存的文件数目 200 到 100000 之间</span><span> ;</span><span> 推荐 4000</span> opcache.max_accelerated_files=2000 <span>;</span><span> 内存“浪费”达到此值对应的百分比,就会发起一个重启调度.</span> opcache.max_wasted_percentage=5 <span>;</span><span> 开启这条指令, Zend Optimizer + 会自动将当前工作目录的名字追加到脚本键上,</span><span> ;</span><span> 以此消除同名文件间的键值命名冲突.关闭这条指令会提升性能,</span><span> ;</span><span> 但是会对已存在的应用造成破坏.</span> opcache.use_cwd=0 <span>;</span><span> 开启文件时间戳验证 </span> opcache.validate_timestamps=1 <span>;</span><span> 2s检查一次文件更新 注意:0是一直检查不是关闭</span><span> ;</span><span> 推荐 60</span> opcache.revalidate_freq=2 <span>;</span><span> 允许或禁止在 include_path 中进行文件搜索的优化</span><span> ;</span><span>opcache.revalidate_path=0</span><span>;</span><span> 是否保存文件/函数的注释 如果apigen、Doctrine、 ZF2、 PHPUnit需要文件注释</span><span> ;</span><span> 推荐 0</span> opcache.save_comments=1 <span>;</span><span> 是否加载文件/函数的注释</span><span> ;</span><span>opcache.load_comments=1</span><span>;</span><span> 打开快速关闭, 打开这个在PHP Request Shutdown的时候会收内存的速度会提高</span><span> ;</span><span> 推荐 1</span> opcache.fast_shutdown=1 <span>;</span><span>允许覆盖文件存在(file_exists等)的优化特性。</span><span> ;</span><span>opcache.enable_file_override=0</span><span>;</span><span> 定义启动多少个优化过程</span><span> ;</span><span>opcache.optimizati/span><span>;</span><span> 启用此Hack可以暂时性的解决”can’t redeclare class”错误.</span><span> ;</span><span>opcache.inherited_hack=1</span><span>;</span><span> 启用此Hack可以暂时性的解决”can’t redeclare class”错误.</span><span> ;</span><span>opcache.dups_fix=0</span><span>;</span><span> 设置不缓存的黑名单</span><span> ;</span><span> 不缓存指定目录下cache_开头的PHP文件. /png/www/example.com/public_html/cache/cache_ </span><span> ;</span><span>opcache.blacklist_filename=</span><span>;</span><span> 通过文件大小屏除大文件的缓存.默认情况下所有的文件都会被缓存.</span><span> ;</span><span>opcache.max_file_size=0</span><span>;</span><span> 每 N 次请求检查一次缓存校验.默认值0表示检查被禁用了.</span><span> ;</span><span> 由于计算校验值有损性能,这个指令应当紧紧在开发调试的时候开启.</span><span> ;</span><span>opcache.c/span><span>;</span><span> 从缓存不被访问后,等待多久后(单位为秒)调度重启</span><span> ;</span><span>opcache.force_restart_timeout=180</span><span>;</span><span> 错误日志文件名.留空表示使用标准错误输出(stderr).</span><span> ;</span><span>opcache.error_log=</span><span>;</span><span> 将错误信息写入到服务器(Apache等)日志</span><span> ;</span><span>opcache.log_verbosity_level=1</span><span>;</span><span> 内存共享的首选后台.留空则是让系统选择.</span><span> ;</span><span>opcache.preferred_memory_model=</span><span>;</span><span> 防止共享内存在脚本执行期间被意外写入, 仅用于内部调试.</span><span> ;</span><span>opcache.protect_memory=0</span></span></span>
The above introduces the configuration instructions of PHP optimization---opcache, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
