最近,我正在将我的应用程序从Symfony 3.4升级到Symfony 4.2。我在告诉read error on connection
时遇到错误。
这是堆栈跟踪:
at var/cache/dev/ContainerRUEbk9e/Redis_ca5fc0f.php:312
at Redis->get('DoctrineNamespaceCacheKey[]')
(var/cache/dev/ContainerRUEbk9e/Redis_ca5fc0f.php:312)
at Redis_ca5fc0f->get('DoctrineNamespaceCacheKey[]')
(vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php:47)
at Doctrine\Common\Cache\RedisCache->doFetch('DoctrineNamespaceCacheKey[]')
(vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:200)
at Doctrine\Common\Cache\CacheProvider->getNamespaceVersion()
(vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:177)
at Doctrine\Common\Cache\CacheProvider->getNamespacedId('9f7b27184e58ac025013b8c22fbdfa8a')
(vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:60)
at Doctrine\Common\Cache\CacheProvider->fetch('9f7b27184e58ac025013b8c22fbdfa8a')
(vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:271)
at Doctrine\ORM\Query->_parse()
(vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:295)
at Doctrine\ORM\Query->_doExecute()
(vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:967)
at Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(null, 1)
(vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:922)
at Doctrine\ORM\AbstractQuery->execute(null, 1)
(vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:726)
at Doctrine\ORM\AbstractQuery->getResult()
(src/Acme/AcmeBundle/Controller/AcmeController.php:1461)
at Acme\AcmeBundle\Controller\AcmeController->acmeAction(object(Request))
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:150)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:67)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:198)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(public/app_dev.php:35)
at runSymfony()
(public/app_dev.php:39)
at require('/var/www/html/project/Website/public/app_dev.php')
(vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:42)
请调查问题
答案 0 :(得分:0)
这可能会有所帮助。以前我的配置是这样的:
snc_redis:
clients:
default:
type: predis
alias: default
dsn: "%redis_dsn%"
options:
read_write_timeout: "%redis_read_write_timeout%"
session:
type: phpredis
alias: session
dsn: "%redis_dsn%"
options:
read_write_timeout: "%redis_read_write_timeout%"
doctrine:
type: phpredis
alias: doctrine
dsn: "%redis_dsn%"
options:
read_write_timeout: "%redis_read_write_timeout%"
session:
client: session
prefix: session:main
doctrine:
metadata_cache:
client: doctrine
entity_manager: default # the name of your entity_manager connection
document_manager: default # the name of your document_manager connection
namespace: "%kernel.root_dir%"
result_cache:
client: doctrine
entity_manager: [default, read] # you may specify multiple entity_managers
query_cache:
client: doctrine
entity_manager: default
更改为以下内容
snc_redis:
clients:
default:
type: predis
alias: default
dsn: "%redis_dsn%"
options:
read_write_timeout: "%redis_read_write_timeout%"
session:
type: predis
alias: session
dsn: "%redis_dsn%"
options:
read_write_timeout: "%redis_read_write_timeout%"
doctrine:
type: predis
alias: doctrine
dsn: "%redis_dsn%"
options:
read_write_timeout: "%redis_read_write_timeout%"
session:
client: session
prefix: session:main
doctrine:
metadata_cache:
client: doctrine
entity_manager: default # the name of your entity_manager connection
document_manager: default # the name of your document_manager connection
namespace: "%kernel.root_dir%"
result_cache:
client: doctrine
entity_manager: [default, read] # you may specify multiple entity_managers
query_cache:
client: doctrine
entity_manager: default
可能会帮助别人。