设为首页 收藏本站
查看: 667|回复: 0

[经验分享] PHP加速插件-opcache参数详解

[复制链接]

尚未签到

发表于 2018-12-15 13:55:40 | 显示全部楼层 |阅读模式
  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    #在脚本执行期间保护的共享内存被意外写入。仅供内部调试。
  





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-651726-1-1.html 上篇帖子: AngularJs 基础教程 —— 与php服务器 下篇帖子: 编译安装LAMP之PHP
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表