jaxwilko / wn-opcachepreload-plugin
Winter CMS 对 opcache 预加载的支持
v0.0.1
2021-10-05 10:53 UTC
This package is auto-updated.
Last update: 2024-09-05 17:22:28 UTC
README
预加载允许你在服务器启动时将 PHP 文件读入内存,这有助于提升性能。但这也意味着当你修改缓存中的某个 PHP 文件时,需要重新启动你的 web 服务器。
请注意,预加载在 Windows 上不受支持。
安装
安装插件
composer require jaxwilko/wn-opcachepreload-plugin
在您的 php.ini
中配置 opcache 设置
[opcache] opcache.enable=1 opcache.memory_consumption=256 opcache.max_accelerated_files=20000 opcache.validate_timestamps=0 opcache.revalidate_freq=0 opcache.preload=/path/to/winter/plugins/jaxwilko/opcachepreload/preload.php opcache.preload_user=apache
将
/path/to/winter
更改为您的配置所需的路径
将
apache
在preload_user
中更改为您的正确用户
使用方法
重启您的 web 服务器(nginx / php-fpm / apache)。
杂项
预加载脚本支持一些用于测试的选项。
OPTIONS
-h, --help show this screen
-d, --dry perform a dry run
-v, --verbose output info
-e, --errors output errors
免责声明
此插件在我的生产环境中运行良好,但这并不意味着它一定会适用于您,请在生产环境中使用前进行彻底测试。