在wamp中为PHP启用opcache [英] Enable opcache for php in wamp

查看:236
本文介绍了在wamp中为PHP启用opcache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在wamp上启用opcache,但是它不起作用.我这样更改设置:

I try to enable opcache on wamp but it doesnt work. I changed the settings like this :

[opcache]
zend_extension=C:/wamp/bin/php/php5.5.12/ext/php_opcache.dll
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000

我在opcache的php扩展名中总是带有红色感叹号 怎么了?一些帮助请

I always have the red exclamation mark in the extension of php for opcache whats wrong? some help pls

它在phpinfo()中

And it is in the the phpinfo()

Zend OPcache
Opcode Caching  Up and Running
Optimization    Enabled
Startup OK
Shared memory model win32
Cache hits  0
Cache misses    1
Used memory 483608
Free memory 133734120
Wasted memory   0
Cached scripts  1
Cached keys 2
Max keys    7963
OOM restarts    0 
Hash keys restarts  0
Manual restarts 0


opcache.blacklist_filename  no value    no value
opcache.consistency_checks  0   0
opcache.dups_fix    Off Off
opcache.enable  On  On
opcache.enable_cli  Off Off
opcache.enable_file_override    Off Off
opcache.error_log   no value    no value
opcache.fast_shutdown   1   1
opcache.file_update_protection  2   2
opcache.force_restart_timeout   180 180
opcache.inherited_hack  On  On
opcache.interned_strings_buffer 8   8
opcache.load_comments   1   1
opcache.log_verbosity_level 1   1
opcache.max_accelerated_files   4000    4000
opcache.max_file_size   0   0
 opcache.max_wasted_percentage  5   5
opcache.memory_consumption  128 128
opcache.mmap_base   no value    no value
opcache.optimization_level  0xFFFFFFFF  0xFFFFFFFF
opcache.preferred_memory_model  no value    no value
opcache.protect_memory  0   0
opcache.restrict_api    no value    no value
opcache.revalidate_freq 60  60
opcache.revalidate_path Off Off
opcache.save_comments   1   1
opcache.use_cwd On  On
opcache.validate_timestamps On  On

我发现了这个,如果您想知道它是否有效: https://github.com/rlerdorf/opcache-status/blob/master/opcache.php

I found this If you want to know if it works : https://github.com/rlerdorf/opcache-status/blob/master/opcache.php

推荐答案

在PHP5.5.12中,opcache作为zend扩展名提供,但可以在标准ext文件夹中找到.

In PHP5.5.12 opcache is delivered as a zend extension but it is found in the standard ext folder.

因此,除了使用zend_extension而不是extension参数之外,您将像其他任何PHP扩展一样加载它,因此请使用wampmanager菜单编辑php.ini文件,以确保像这样编辑正确的文件. :-

You would therefore load it just like any other PHP extension, apart from using the zend_extension rather than extension paramter, so edit your php.ini file using the wampmanager menus to make sure you edit the right file like so :-

wampmanager -> PHP -> php.ini

首先检查此参数的设置是否正确:

First check that this parameter is set correctly :

extension_dir = "C:/wamp/bin/php/php5.5.12/ext/"

现在在示例中已加载OpCache dll的位置,请按照以下步骤进行操作,它将从默认扩展名文件夹中加载,就像普通的extension=将是:-

Now where you have loaded the OpCache dll in your example, do it like this and it will be loaded from the default extension folder just like a normal extension= would be :-

zend_extension=php_opcache.dll

您可以这样做:-

zend_extension="C:/wamp/bin/php/php5.5.12/ext/php_opcache.dll"

,但是无需指定从标准ext文件夹加载的完整路径.

but there is no need to specify the full path as it is loaded from the standard ext folder.

警告

Warning

如果您仍在开发中,几乎可以肯定不要打开它,因为它不会增加任何好处,并且可能会增加标准编译的时间,在每次代码更改后检索,并且可能不会重新编译并使用不需要的时候缓存代码.

If you are still developing you almost definitely don't what this turned on as it won't add any benefit and could add time to a standard compilation, recaching after every code change, and possibly not re-compiling and using the cached code when you don't want it to.

这篇关于在wamp中为PHP启用opcache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆