本文介绍了Zend OPCache-opcache.enable_cli是1还是0?它有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在文档中它说主要用于调试",这会使我认为除非有问题并需要进行一些调试,否则请不要启用它",但是阅读我能找到的大部分内容后,便说启用它"opcache.enable_cli 1",但是为什么呢?我找不到有关此问题的任何信息,所以如果有人知道,如果文档基本上说将其保持为0,为什么我应该启用它?

In the documentation it says "mostly used for debugging" which would lead me think "never enable it unless you've a problem and need to do some debugging," however reading mostly everything that I could find about it says to enable it "opcache.enable_cli 1" but why? I could not find any information concerning this matter, so if anybody knows, why should I enable it if the documentation basically says to keep it on 0?

推荐答案

将其保留.主要用于调试OPcache本身的问题时.

Leave it off. It's primarily there for use while debugging issues with OPcache itself.

当从命令行(使用php命令)运行PHP脚本时,opcache.enable_cli选项启用PHP OPcache.但是,请记住,对于PHP 5.x,OPcache扩展的工作原理是将缓存的操作码存储在当前进程的内存 中.仅当运行PHP的进程将处理多个可以重用这些操作码的请求时才有用,例如在Web服务器中或在FastCGI下.对于像PHP CLI这样的过程,它运行一个请求"并退出,只会浪费内存和时间.

The opcache.enable_cli option enables PHP OPcache when running PHP scripts from the command line (using the php command). However, keep in mind that for PHP 5.x the OPcache extension works by storing cached opcodes in the memory of the current process. This is only useful when the process that's running PHP is going to be handling multiple requests that can reuse these opcodes, like in a web server or under FastCGI. For a process like the PHP CLI, which runs one "request" and exits, it just wastes memory and time.

这篇关于Zend OPCache-opcache.enable_cli是1还是0?它有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 06:22