wampserver - opcache 没有出现在 phpinfo() 中

wampserver - opcache not showing up in phpinfo()

描述

我正在尝试加载 php_opcache 以加速我的应用程序,但似乎无法让它显示在我的 wampserver 上的 phpinfo 中。我已经在 apache httpd.conf 和 dll php_opcache 中加载了 mod_fcgi,如下所示,在 PHP 设置下。

我尝试了

的建议

1) https://commaster.net/content/installing-php-fastcgi-and-zend-opcache-wampserver
2) http://forum.wampserver.com/read.php?2,130577,130577

无论我尝试什么,当我停止并重新启动 wampserver 时,我只在我的服务器上看到带有红色感叹号的 opcache。

我在下面包含了我的设置。

如何解决这个问题?

Apache 设置

Apache LoadModule 指令(C:\wamp\bin\apache\apache2.4.9\conf)

LoadModule fcgid_module modules/mod_fcgid.so

PHP 设置

php_opcache.dll

php_opcache.dll 显示在 wampserver php ext 文件夹中

c:\wamp\bin\php\php5.5.12\php.ini

zend_extension = php_opcache.dll

[opcache]
opcache.enable = 1
opcache.memory_consumption = 128
opcache.max_accelerated_files = 4000
opcache.revalidate_freq = 60

wampserver 加载模块

(php_opache 显示为感叹号)

1) 在确保两行都出现在 httpd.conf

之后
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
LoadModule fcgid_module modules/mod_fcgid.so

2) 我继续将以下行添加到 httpd.conf

<IfModule fcgid_module>
    FcgidInitialEnv PATH "C:/wamp/bin/php/php5.5.12;C:/WINDOWS/system32"
    FcgidInitialEnv SystemRoot "C:/Windows"
    FcgidInitialEnv SystemDrive "C:"
    FcgidInitialEnv TEMP "C:/Wamp/tmp"
    FcgidInitialEnv TMP "C:/Wamp/tmp"
    FcgidInitialEnv windir "C:/WINDOWS"
    FcgidIOTimeout 64
    FcgidConnectTimeout 16
    FcgidMaxRequestsPerProcess 1000 
    FcgidMaxProcesses 3
    FcgidMaxRequestLen 8131072
    # Location php.ini:
    FcgidInitialEnv PHPRC "C:/wamp/bin/php/php5.5.12"
    FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000

    <Files ~ "\.php$">
        Options Indexes FollowSymLinks ExecCGI 
        AddHandler fcgid-script .php
        FcgidWrapper "C:/wamp/bin/php/php5.5.12/php-cgi.exe" .php
    </Files>
</IfModule>

3) 然后我将以下内容添加到 php.ini

zend_extension = "c:/wamp/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11-x86_64.dll"
;
[xdebug]
xdebug.remote_enable = on
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.show_local_vars=0
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_port = 9000




zend_extension = "c:/wamp/bin/php/php5.5.12/ext/php_opcache.dll"
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1

; Determines if Zend OPCache is enabled for the CLI version of PHP
opcache.enable_cli=1

; The OPcache shared memory storage size.
opcache.memory_consumption=64

; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=4

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 100000 are allowed.
opcache.max_accelerated_files=2000

; 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

4) 最后,我确保在 ext 目录和 zend_ext 目录中都有 php_opcache.dll 并重新启动 wampserver。

5) 最后,当 运行 我的 phpinfo() 脚本时,我终于看到了列出的 Zend PHP OpCache。

在页面开头我也确认了显示的消息。

This program makes use of the Zend Scripting Language Engine: Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies