使用 Symfony 5.1 和 PHP 7.4,我想添加 preload.php
在 opcache 中。
Symfony documentation :
During container compilation (e.g. when running the cache:clear command), Symfony generates a file called preload.php in the config/ directory with the list of classes to preload.
opcache.preload=/path/to/project/config/preload.php
但是当我执行
cache:clear
,我没有preload.php
文件在 /config/
目录。谷歌搜索后,this site indicates :
Now, in PhpStorm, check out the var/cache/prod/ directory... here it is: App_KernelProdContainer.preload.php.
我有这个文件 .是我做错了什么还是 symfony 的文档不是最新的?
最佳答案
该文件不是在缓存生成过程中生成的,因此可以执行cache:clear
所有你想要的,它不会为你生成。如果文档是这样说的,那就错了。
该文件被复制到相应的 flex 配方中。您可以查看文件here .
您可以通过执行以下命令来检查配方创建的文件:
composer symfony:recipes symfony/framework-bundle
要自动重新安装配方,只需执行:composer sync-recipes symfony/framework-bundle --force
关于php - preload.php 文件在哪里,它是如何生成的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65467847/