为了账号安全,请及时绑定邮箱和手机立即绑定

PHP加速插件-opcache参数详解

标签:
PHP

PHP加速插件-opcache参数详解

zend_extension=opcache.so    #这样去加扩展

opcache.memory_consumption=128      #为opcache分配多少共享内存128M

opcache.interned_strings_buffer=8   #interned string的内存大小

opcache.max_accelerated_files=4000  #最大缓存的文件数目

opcache.revalidate_freq=300         #opcache自动检测文件是否更新的周期,单位秒

opcache.fast_shutdown=1             ##如果启用,快速关闭序列用于加速代码

opcache.enable_cli=1                #是否在CLI(即命令行时)启用opcache   1启用



; Determines if Zend OPCache is enabled

;opcache.enable=0     #是否启用opcache  1启用


; Determines if Zend OPCache is enabled for the CLI version of PHP

;opcache.enable_cli=0    #是否在CLI(即命令行时)启用opcache   1启用


; The OPcache shared memory storage size.

;opcache.memory_consumption=64    #为opcache分配多少共享内存,单位M


; The amount of memory for interned strings in Mbytes.

;opcache.interned_strings_buffer=4    #interned string的内存大小


; The maximum number of keys (scripts) in the OPcache hash table.

; Only numbers between 200 and 100000 are allowed.

;opcache.max_accelerated_files=2000    #最大缓存的文件数目。实际上这个值会使用第一个大于你配置的数字的下列素数{ 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987 },如你将该值指定为400,则实际上该值为463.

; The maximum percentage of "wasted" memory until a restart is scheduled.

;opcache.max_wasted_percentage=5    #


; When this directive is enabled, the OPcache appends the current working

; directory to the script key, thus eliminating possible collisions between

; files with the same name (basename). Disabling the directive improves

; performance, but may break existing applications.

;opcache.use_cwd=1    #如果置为1,则将当前路径加入到文件key中,以避免可能产生的同文件名的文件key冲突


; When disabled, you must reset the OPcache manually or restart the

; webserver for changes to the filesystem to take effect.

;opcache.validate_timestamps=1    #如果置为1,则OPCACHE会自动检测文件的时间戳(检测周期为revalidate_freq),并根据文件的时间戳来更新opcode,如果置为0,则只能手动去重启opcache或重启webserver以使更新后的php文件生效


; How often (in seconds) to check file timestamps for changes to the shared

; memory storage allocation. ("1" means validate once per second, but only

; once per request. "0" means always validate)

;opcache.revalidate_freq=2   #opcache自动检测文件是否更新的周期,单位秒。如果是0,则每次请求时opcache都要进行检测。当validate_timestamps为0时,本指令无效。


; Enables or disables file search in include_path optimization

;opcache.revalidate_path=0    #


; If disabled, all PHPDoc comments are dropped from the code to reduce the

; size of the optimized code.

;opcache.save_comments=1    #是否禁用文件中的注释


; If disabled, PHPDoc comments are not loaded from SHM, so "Doc Comments"

; may be always stored (save_comments=1), but not loaded by applications

; that don't need them anyway.

;opcache.load_comments=1    #如果禁用,注释不会被加载,就是不禁用,注释也不会被应用程序加载


; If enabled, a fast shutdown sequence is used for the accelerated code

;opcache.fast_shutdown=0     #如果启用,快速关闭序列用于加速代码


; Allow file existence override (file_exists, etc.) performance feature.

;opcache.enable_file_override=0   #允许文件存在覆盖(file_exists等)性能特性。


; A bitmask, where each bit enables or disables the appropriate OPcache

; passes

;opcache.optimization_level=0xffffffff    #位掩码,每一位启用或禁用相应的OPcache


;opcache.inherited_hack=1

;opcache.dups_fix=0       #为解决“cannot redecllare class" 时,可将其置为1


; The location of the OPcache blacklist file (wildcards allowed).

; Each OPcache blacklist file is a text file that holds the names of files

; that should not be accelerated. The file format is to add each filename

; to a new line. The filename may be a full path or just a file prefix

; (i.e., /var/www/x  blacklists all the files and directories in /var/www

; that start with 'x'). Line starting with a ; are ignored (comments).

;opcache.blacklist_filename=     #黑名单文件设置


; Allows exclusion of large files from being cached. By default all files

; are cached.

;opcache.max_file_size=0   #允许排除大文件缓存。在默认情况下所有文件缓存。


; Check the cache checksum each N requests.

; The default value of "0" means that the checks are disabled.

;opcache.consistency_checks=0    #每N个请求检查缓存校验,默认值“0”意味着检查禁用。开启检查有损性能,所以仅在调试时开启


; How long to wait (in seconds) for a scheduled restart to begin if the cache

; is not being accessed.

;opcache.force_restart_timeout=180    #缓存中没有被访问多长时间(以秒为单位)调度重启。


; OPcache error_log file name. Empty string assumes "stderr".

;opcache.error_log=    #留空表示标准错误输出


; All OPcache errors go to the Web server log.

; By default, only fatal errors (level 0) or errors (level 1) are logged.

; You can also enable warnings (level 2), info messages (level 3) or

; debug messages (level 4).

;opcache.log_verbosity_level=1   #所有OPcache错误导向Web服务器日志。默认情况下,只有致命错误(0级)或错误(1级)被记录。你也可以启用警告(要求等级2),信息消息(3级)或调试消息(四级)。


; Preferred Shared Memory back-end. Leave empty and let the system decide.

;opcache.preferred_memory_model=    #首选的共享内存的后端。留空,让系统决定。


; Protect the shared memory from unexpected writing during script execution.

; Useful for internal debugging only.

;opcache.protect_memory=0    #在脚本执行期间保护的共享内存被意外写入。仅供内部调试。


点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消