Laravel 5.4 运行 `PHP artisan optimize` 不再生成编译文件
公司项目升级到 5.4 后 运行 optimize 命令得到如下输出
Generating optimized class loader
The compiled services file has been removed.
检查 bootstrap
目录下确实没有生成编译文件。以为是 APP_ENV
环境变量设置有误,检查无误。猜测是 5.4 移除了该功能,果然在 github 的 laravel/framework PR 上找到了答案。
Since Laravel 5.5 will be PHP 7.0+ it makes sense to remove this feature, since the best way to optimize performance in PHP 7 is just to correctly configure opcache to what's best for your server and websites.
这条建议被 Taylor 采纳并最终合并到了 5.4 ,坑爹的是 5.4 升级指南中并没有说明这一点。
所以现在开始忘记 optimize 命令吧,请使用字节码缓存 OPcache 替代。
推荐文章: