OPcache
出自MoodleDocs
Template:環境 Template:新特性 標準的 OPcache 擴展被強烈推薦使用;自從 Moodle 2.6 版本開始,OPcache 也是被 PHP 官方支持的擴展。
使用 OPcache 能夠增加性能,同時能夠顯著降低內存使用。
安裝
OPcache 擴展隨着 PHP 5.5.0 和更新的版本。OPcache 也可以在一些較早的 PHP 版本中運行,OPcache 來自於 PECL,這個擴展的組織名為 ZendOPcache。
注意:如果你現在正在運行 PHP 5.3 或者 5.4,你可以完全忽略這個有關 OpCache 的環境校驗信息。
配置
PHP.ini 配置:
[opcache]
opcache.enable = 1
opcache.memory_consumption = 128
opcache.max_accelerated_files = 4000
opcache.revalidate_freq = 60
- Required for Moodle
opcache.use_cwd = 1
opcache.validate_timestamps = 1
opcache.save_comments = 1
opcache.enable_file_override = 0
- If something does not work in Moodle
- opcache.revalidate_path = 1 ; May fix problems with include paths
- Experimental for Moodle 2.6 and later
- opcache.fast_shutdown = 1
- opcache.enable_cli = 1 ; Speeds up CLI cron
- opcache.load_comments = 0 ; May lower memory use, might not be compatible with add-ons and other apps.
如果你使用的是 IIS,你需要 PHP 5.5 版本,同時你需要將 opcache 擴展添加到 php.ini 文件的 ExtensionList 中。
[ExtensionList]
...
zend_extension=php_opcache.dll
請查看相關內容
論壇討論: