簡體   English   中英

PHP 5.5 OPCache無法處理apache

[英]PHP 5.5 OPCache not working on apache

我負責我公司的操作碼緩存交換,我們正在從eaccelerator轉移到PHP 5.5附帶的Zend OPCache。

當我在CLI中訪問PHP時,似乎OPCache工作正常:

PHP 5.5.5 (cli) (built: Oct 15 2013 10:29:13)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies

但是當我通過Apache訪問我的網站時,與沒有使用操作碼緩存的相同頁面相比,基准測試沒有顯示出任何改進。 此外, get_loaded_extensions(true)返回一個空數組。

任何人都可以回答我為什么它在地球上不起作用?

我正在使用Windows 7,來自Apache Lounge的Apache 2.4.6,來自windows.php.net的PHP 5.5.5。


編輯:

根據要求,我的OPCache配置:

[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
;opcache.max_wasted_percentage=5
;opcache.use_cwd=1
;opcache.validate_timestamps=1
opcache.revalidate_freq=60
;opcache.revalidate_path=0
;opcache.save_comments=1
;opcache.load_comments=1
opcache.fast_shutdown=1
;opcache.enable_file_override=0
;opcache.optimization_level=0xffffffff
;opcache.inherited_hack=1
;opcache.dups_fix=0
;opcache.blacklist_filename=
;opcache.max_file_size=0
;opcache.consistency_checks=0
;opcache.force_restart_timeout=180
;opcache.error_log=
;opcache.log_verbosity_level=1
;opcache.preferred_memory_model=
;opcache.protect_memory=0

找到答案了!

zend_extension擴展必須設置完整路徑,而不是相對路徑。

在這種情況下, zend_extension="C:\\Apache24\\php\\ext\\php_opcache.dll"解決了我的問題。

WINDOWS PHP 7解決方案

默認情況下,php.ini文件中有opcache設置,如opcache.eneable,但啟用opcache不會生效,除非你添加:

zend_extension=php_opcache.dll

到您的配置文件。 記住它是zend_extension而不是常規的exstension!

確保你的phpinfo()中有“opcache”; 報告。 默認情況下

此PECL擴展的DLL當前不可用。 另請參見Windows上構建部分。

你能確認擴展已加載嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM