Sylius 缓存管理
Posted
技术标签:
【中文标题】Sylius 缓存管理【英文标题】:Sylius cache management 【发布时间】:2014-04-15 06:01:36 【问题描述】:当我开始使用 Sylius 时,我并没有意识到它还不稳定,我完全定制了 dev 版本,而不是开始一个新项目。现在,由于缓存管理,我认为我不能将其放入 prod 中:
图像并不总是加载,但有时:
Resource interpreted as Image but transferred with MIME type text/html
CSS 和 JS 相同:
net::ERR_CONNECTION_RESET
而且我无法使用php app/console cache:clear -e prod
清除缓存:
使用 debug true 清除 prod 环境的缓存 PHP 致命错误:C:\wamp\www\sylius\app\cache\pro_\twig\9a\2e\9cb2d88c764cb674efaa179d7259f64ff3b6396785924a758ca5728914b5.php 中允许的内存大小为 134217728 字节(尝试分配 98304 字节)已用尽 PHP堆栈跟踪: PHP 1. main() C:\wamp\www\sylius\app\console:0 PHP 2. Symfony\Component\Console\Application->run() C:\wamp\www\sylius\app\console:28 PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121 PHP 4. Symfony\Component\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:96 PHP 5. Symfony\Component\Console\Application->doRunCommand() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:191 PHP 6. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:905 PHP 7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:244 PHP 8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:83 PHP 9. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:120 PHP 10. Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php:47 PHP 11. Twig_Environment->loadTemplate() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer.php:62 致命错误:C:\wamp\www\sylius\app\cache\pro_\twig\9a\2e\9cb2d88c764cb674efaa179d7259f64ff3b6396785924a758ca5728914b5.php 中允许的内存大小为 134217728 字节已用尽(尝试分配 98304 字节)在线 调用堆栈: 0.0005 331032 1. main() C:\wamp\www\sylius\app\console:0 0.0698 3608112 2. Symfony\Component\Console\Application->run() C:\wamp\www\sylius\app\console:28 0.0764 3860448 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121 0.6014 15730344 4. Symfony\Component\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:96 0.6027 15730344 5. Symfony\Component\Console\Application->doRunCommand() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:191 0.6034 15755448 6. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:905 0.6037 15755792 7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:244 0.7519 16165176 8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:83 7.0263 57502064 9. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:120 14.6093 95010368 10. Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php:47 21.6284 133900880 11. Twig_Environment->loadTemplate() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer.php:62
编辑:我已经手动清除了缓存,但它没有改变任何东西。
【问题讨论】:
您可以尝试运行$ rm -rf app/cache/*
看看是否有帮助
取决于您使用什么来运行命令。 Cygwin 或 Git Bash 将执行该 rm 命令。您也可以使用 Windows 资源管理器删除 app/cache 目录中的所有文件
抱歉,我忘了补充说我已经尝试手动清除了。
您是否阅读过错误消息?他们真的很清楚,php配置的memory_limit太少
【参考方案1】:
试试这个: "#!/user/local/bin/php app/console cache:clear --env=prod"
答案基于 symfony 文档:
https://symfony.com/doc/2.8/console/usage.html
【讨论】:
以上是关于Sylius 缓存管理的主要内容,如果未能解决你的问题,请参考以下文章