OPcache

来自MoodleDocs
Yucheng Hu讨论 | 贡献2013年12月30日 (一) 05:24的版本 →‎Installation
跳转至:导航、​搜索

Template:Environment Template:New features The standard OPcache extension is strongly recommended; since Moodle 2.6, it is the only solution officially supported by PHP developers. The benefits are increased performance and significantly lower memory usage.

安装

OPcache 扩展随着 PHP 5.5.0 和更新的版本。OPcache 也可以在一些较早的 PHP 版本中运行,OPcache 来自于 PECL,这个扩展的组织名为 ZendOPcache。

注意:如果你现在正在运行 PHP 5.3 或者 5.4,你可以完全忽略这个有关 OpCache 的环境校验信息。

Configuration

PHP.ini settings:

[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.

When using IIS you will need PHP 5.5 and you will need to add the extension for opcache under the ExtensionList section of the php.ini file.

[ExtensionList] ... zend_extension=php_opcache.dll

See also

Forum discussions: