PHP optimization---opcache configuration instructions

WBOY
Release: 2016-07-29 08:56:54
Original
1103 people have browsed it
<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>
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!