简体   繁体   English

如何刷新使用phar.cache_list指令缓存的phar?

[英]How do freshen a phar cached with the phar.cache_list directive?

I added my phar to the cache_list directive in php.ini and caching worked great. 我将我的phar添加到php.inicache_list指令中,并且缓存工作得很好。 A few days later I updated the phar now I get the following error: 几天后我更新了phar,现在我收到以下错误:

Warning: Phar::webPhar(phar:///usr/share/app/app.phar/www.php): failed to open
stream: phar error: internal corruption of phar "/usr/share/app/app.phar"
(crc32 mismatch on file "www.php") in /usr/share/app/app.phar on line 8

If I comment out the cache_list directive, the phar works and loads fine, but now I can no longer cache it. 如果我注释掉cache_list指令,那么phar工作并加载正常,但现在我不能再缓存它。 This make me think that PHP is looking at the crc32 of the old file. 这让我觉得PHP正在查看旧文件的crc32

I have tried restarting apache I don't know how else to "freshen" the cache or if this is even the issue. 我试过重启apache我不知道如何“刷新”缓存或者甚至是问题。

I would suggest deleting or renaming your old app.phar file. 我建议删除或重命名旧的app.phar文件。 The system should regenerate a new one on your next load. 系统应在您下次加载时重新生成一个新系统。 If the same error crops up, you have one of two problems: 如果出现相同的错误,则会出现以下两个问题之一:

  • One of the paths to the phars you have cached is wrong, causing the whole list to fail. 您缓存的phars的路径之一是错误的,导致整个列表失败。
  • One of the phars you are caching has no meta data, causing it to fail. 您正在缓存的其中一个phars没有元数据,导致它失败。

A good test for the second one is adding a piece of junk metadata(that is, if you're not already using metadata). 对第二个测试的一个很好的测试是添加一段垃圾元数据(也就是说,如果你还没有使用元数据)。 phar::setMetadata() 药业:: setMetadata()

As usual, check all your paths. 像往常一样,检查所有路径。

Without a good view of the code your running or what was changed, I can't really suggest anything further. 如果没有良好的运行代码或更改的代码,我无法提出任何进一步的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM