从2.8升级到3.0后,我遇到了APC问题。
[2015-12-05 17:03:05] php.CRITICAL: Fatal Error: Class 'Symfony\Component\Validator\Mapping\Cache\ApcCache' not found {"type":1,"file":"/var/www/vhosts/host/httpdocs/var/cache/prod/appProdProjectContainer.php","line":1102,"level":6143,"stack":[]} []
[2015-12-05 17:03:05] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ClassNotFoundException: "Attempted to load class "ApcCache" from namespace "Symfony\Component\Validator\Mapping\Cache". Did you forget a "use" statement for another namespace?" at /var/www/vhosts/host/httpdocs/var/cache/prod/appProdProjectContainer.php line 1102 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ClassNotFoundException(code: 0): Attempted to load class \"ApcCache\" from namespace \"Symfony\\Component\\Validator\\Mapping\\Cache\".\nDid you forget a \"use\" statement for another namespace? at /var/www/vhosts/host/httpdocs/var/cache/prod/appProdProjectContainer.php:1102)"} []
我怎么能解决这个问题? appProdProjectContainer.php symfony自动生成。
UP: 我的composer.json
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.0.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0"
},
由于
答案 0 :(得分:2)
删除/app/cache/dev
(或/var/cache/dev
,如果您使用的是Symfony 3.0)目录并再次运行Symfony。
说明:由于缓存是使用Symfony 2.8创建的,因此它包含了已弃用的ApcCache类。现在您更新了2.8到3.0,可能会运行php app/console cache:clear
。这意味着您首先必须启动Symfony 3.0,在此阶段由于缓存被破坏而出错。
答案 1 :(得分:0)
升级到Symfony 3.0时,您是否正确升级了web/app.php
和web/app_dev.php
?
即使它是2.7到2.8的升级路径,你也应该看看这个差异文件:https://github.com/symfony/symfony-standard/compare/2.7...2.8#diff-12(和web/app_dev.php
相同)。
确保这些更改也反映在您的文件中。您也可以直接在文件中复制并粘贴this和that。
确保composer.json
文件中也包含以下行(如果没有,请应用更改并再次运行composer update
):
"autoload": {
"psr-4": { "": "src/" },
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
}