Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试将symfony 5应用程序与heroku上的redis连接时出错_Heroku_Redis_Symfony5 - Fatal编程技术网

尝试将symfony 5应用程序与heroku上的redis连接时出错

尝试将symfony 5应用程序与heroku上的redis连接时出错,heroku,redis,symfony5,Heroku,Redis,Symfony5,我在尝试将symfony 5应用程序与heroku上的redis服务器连接时遇到问题。 -我的composer.json和composer.lock设置了ext redis:* "require": { "php": "~7.4.0", "ext-ctype": "*", "ext-iconv": "*", "ext-intl": "*", "ext-openssl": "*", "ext-redis

我在尝试将symfony 5应用程序与heroku上的redis服务器连接时遇到问题。
-我的composer.json和composer.lock设置了ext redis:*

"require": {
        "php": "~7.4.0",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "ext-intl": "*",
        "ext-openssl": "*",
        "ext-redis": "*",
        ...
}
  • 我在heroku上有3个配置变量:
heroku redis模块激活后创建的默认变量
REDIS_URL=REDIS://h:someHash@ec2.eu-west-1.compute.amazonaws.com:27269

自定义变量以适应php类Redis构造函数
REDIS_HOST=REDIS://h:someHash@ec2.eu-west-1.compute.amazonaws.com
REDIS_端口=27269

我的部署在以下错误时停止:找不到套接字传输“redis”-配置PHP时是否忘记启用它?

部署完整日志:



-----> PHP app detected

-----> Bootstrapping...

-----> Installing platform packages...

       - php (7.4.6)

       - ext-intl (bundled with php)

       - ext-redis (5.2.2)

       - apache (2.4.43)

       - nginx (1.18.0)

-----> Installing dependencies...

       Composer version 1.10.6 2020-05-06 10:28:10

       Loading composer repositories with package information

       Installing dependencies from lock file

       Package operations: 108 installs, 0 updates, 0 removals

         - Installing ocramius/package-versions (1.8.0): Loading from cache

         - Installing symfony/flex (v1.6.3): Loading from cache

         - Installing symfony/polyfill-mbstring (v1.17.0): Loading from cache

         - Installing mtdowling/jmespath.php (2.5.0): Loading from cache

         - Installing ralouphie/getallheaders (3.0.3): Loading from cache

         - Installing psr/http-message (1.0.1): Loading from cache

         - Installing guzzlehttp/psr7 (1.6.1): Loading from cache

         - Installing guzzlehttp/promises (v1.3.1): Loading from cache

         - Installing symfony/polyfill-intl-idn (v1.17.0): Loading from cache

         - Installing guzzlehttp/guzzle (6.5.3): Loading from cache

         - Installing aws/aws-sdk-php (3.138.0): Loading from cache

         - Installing doctrine/cache (1.10.0): Loading from cache

         - Installing doctrine/collections (1.6.4): Loading from cache

         - Installing doctrine/inflector (1.4.1): Loading from cache

         - Installing doctrine/instantiator (1.3.0): Loading from cache

         - Installing doctrine/lexer (1.2.0): Loading from cache

         - Installing psr/container (1.0.0): Loading from cache

         - Installing symfony/service-contracts (v2.0.1): Loading from cache

         - Installing symfony/stopwatch (v5.0.8): Loading from cache

         - Installing symfony/polyfill-php73 (v1.17.0): Loading from cache

         - Installing symfony/console (v5.0.8): Loading from cache

         - Installing webimpress/safe-writer (2.0.1): Loading from cache

         - Installing laminas/laminas-zendframework-bridge (1.0.3): Loading from cache

         - Installing laminas/laminas-eventmanager (3.2.1): Loading from cache

         - Installing laminas/laminas-code (3.4.1): Loading from cache

         - Installing ocramius/proxy-manager (2.8.0): Loading from cache

         - Installing doctrine/event-manager (1.1.0): Loading from cache

         - Installing doctrine/dbal (2.10.2): Loading from cache

         - Installing doctrine/migrations (2.2.1): Loading from cache

         - Installing doctrine/annotations (1.10.2): Loading from cache

         - Installing doctrine/reflection (1.2.1): Loading from cache

         - Installing twig/twig (v3.0.3): Loading from cache

         - Installing symfony/translation-contracts (v2.0.1): Loading from cache

         - Installing symfony/validator (v5.0.8): Loading from cache

         - Installing symfony/twig-bridge (v5.0.8): Loading from cache

         - Installing symfony/mime (v5.0.8): Loading from cache

         - Installing symfony/http-foundation (v5.0.8): Loading from cache

         - Installing psr/event-dispatcher (1.0.0): Loading from cache

         - Installing symfony/event-dispatcher-contracts (v2.0.1): Loading from cache

         - Installing symfony/event-dispatcher (v5.0.8): Loading from cache

         - Installing symfony/var-dumper (v5.0.8): Loading from cache

         - Installing psr/log (1.1.3): Loading from cache

         - Installing symfony/error-handler (v5.0.8): Loading from cache

         - Installing symfony/http-kernel (v5.0.8): Loading from cache

         - Installing symfony/filesystem (v5.0.8): Loading from cache

         - Installing symfony/config (v5.0.8): Loading from cache

         - Installing symfony/twig-bundle (v5.0.8): Loading from cache

         - Installing symfony/translation (v5.0.8): Loading from cache

         - Installing symfony/security-core (v5.0.8): Loading from cache

         - Installing symfony/inflector (v5.0.8): Loading from cache

         - Installing symfony/property-access (v5.0.8): Loading from cache

         - Installing symfony/security-http (v5.0.8): Loading from cache

         - Installing symfony/security-guard (v5.0.8): Loading from cache

         - Installing symfony/security-csrf (v5.0.8): Loading from cache

         - Installing symfony/dependency-injection (v5.0.8): Loading from cache

         - Installing symfony/security-bundle (v5.0.8): Loading from cache

         - Installing symfony/routing (v5.0.8): Loading from cache

         - Installing symfony/finder (v5.0.8): Loading from cache

         - Installing symfony/var-exporter (v5.0.8): Loading from cache

         - Installing psr/cache (1.0.1): Loading from cache

         - Installing symfony/cache-contracts (v2.0.1): Loading from cache

         - Installing symfony/cache (v5.0.8): Loading from cache

         - Installing symfony/framework-bundle (v5.0.8): Loading from cache

         - Installing symfony/options-resolver (v5.0.8): Loading from cache

         - Installing symfony/intl (v5.0.8): Loading from cache

         - Installing symfony/polyfill-intl-icu (v1.17.0): Loading from cache

         - Installing symfony/form (v5.0.8): Loading from cache

         - Installing symfony/expression-language (v5.0.8): Loading from cache

         - Installing doctrine/persistence (1.3.7): Loading from cache

         - Installing symfony/doctrine-bridge (v5.0.8): Loading from cache

         - Installing symfony/asset (v5.0.8): Loading from cache

         - Installing pagerfanta/pagerfanta (v2.1.3): Loading from cache

         - Installing doctrine/common (2.12.0): Loading from cache

         - Installing doctrine/orm (v2.7.2): Loading from cache

         - Installing jdorn/sql-formatter (v1.2.17): Loading from cache

         - Installing doctrine/doctrine-bundle (2.0.8): Loading from cache

         - Installing easycorp/easyadmin-bundle (v2.3.8): Loading from cache

         - Installing behat/transliterator (v1.3.0): Loading from cache

         - Installing gedmo/doctrine-extensions (v2.4.41): Loading from cache

         - Installing symfony/process (v5.0.8): Loading from cache

         - Installing matleo/bank-statement-parser (dev-master 88ebc8e): Loading from cache

         - Installing phpdocumentor/reflection-common (2.1.0): Loading from cache

         - Installing phpdocumentor/type-resolver (1.1.0): Loading from cache

         - Installing sensio/framework-extra-bundle (v5.5.5): Loading from cache

         - Installing symfony/dotenv (v5.0.8): Loading from cache

         - Installing symfony/http-client-contracts (v2.0.1): Loading from cache

         - Installing symfony/http-client (v5.0.8): Loading from cache

         - Installing egulias/email-validator (2.1.17): Loading from cache

         - Installing symfony/mailer (v5.0.8): Loading from cache

         - Installing monolog/monolog (2.0.2): Loading from cache

         - Installing symfony/monolog-bridge (v5.0.8): Loading from cache

         - Installing symfony/monolog-bundle (v3.5.0): Loading from cache

         - Installing symfony/notifier (v5.0.8): Loading from cache

         - Installing doctrine/doctrine-migrations-bundle (2.1.2): Loading from cache

         - Installing symfony/orm-pack (v1.0.8): Loading from cache

         - Installing symfony/serializer (v5.0.8): Loading from cache

         - Installing symfony/property-info (v5.0.8): Loading from cache

         - Installing webmozart/assert (1.8.0): Loading from cache

         - Installing phpdocumentor/reflection-docblock (5.1.0): Loading from cache

         - Installing symfony/serializer-pack (v1.0.3): Loading from cache

         - Installing symfony/polyfill-intl-normalizer (v1.17.0): Loading from cache

         - Installing symfony/polyfill-intl-grapheme (v1.17.0): Loading from cache

         - Installing symfony/string (v5.0.8): Loading from cache

         - Installing twig/extra-bundle (v3.0.3): Loading from cache

         - Installing symfony/twig-pack (v1.0.0): Loading from cache

         - Installing psr/link (1.0.0): Loading from cache

         - Installing symfony/web-link (v5.0.8): Loading from cache

         - Installing symfony/yaml (v5.0.8): Loading from cache

       Generating optimized autoload files

       ocramius/package-versions: Generating version class...

       ocramius/package-versions: ...done generating version class

       62 packages you are using are looking for funding.

       Use the `composer fund` command to find out more!

       Executing script cache:clear [KO]

        [KO]

       Script cache:clear returned with error code 1

       !!  

       !!  In App_KernelProdContainer.php line 3884:

       !!                                                                                 

       !!    Unable to find the socket transport "redis" - did you forget to enable it w  

       !!    hen you configured PHP?                                                      

       !!                                                                                 

       !!  

       !!  

       Script @auto-scripts was called via post-install-cmd

 !     ERROR: Dependency installation failed!

 !     

 !     The 'composer install' process failed with an error. The cause

 !     may be the download or installation of packages, or a pre- or

 !     post-install hook (e.g. a 'post-install-cmd' item in 'scripts')

 !     in your 'composer.json'.

 !     

 !     Typical error cases are out-of-date or missing parts of code,

 !     timeouts when making external connections, or memory limits.

 !     

 !     Check the above error output closely to determine the cause of

 !     the problem, ensure the code you're pushing is functioning

 !     properly, and that all local changes are committed correctly.

 !     

 !     For more information on builds for PHP on Heroku, refer to

 !     https://devcenter.heroku.com/articles/php-support

 !     Push rejected, failed to compile PHP app.

 !     Push failed

是否缺少扩展?

您只需正确实例化\Redis对象即可。根据您提供的Redis URL,它应该是这样的(phpredis扩展代码):


这里棘手的部分是,您不需要Heroku提供的Redis URL中的用户名“t”。

您所需要的只是正确实例化\Redis对象。根据您提供的Redis URL,它应该是这样的(phpredis扩展代码):


这里棘手的部分是,您不需要Heroku提供的Redis URL中的用户名“t”。

我认为问题来自于使用php Redis扩展,Heroku告诉您使用Predis。但是由于Predis不再维护,我如何使它与php redis扩展一起工作?heroku Build中似乎缺少php igbinary模块。我认为问题在于使用php redis扩展时,heroku告诉用户使用Predis。但是由于Predis不再维护,我如何使它与php redis扩展一起工作?heroku Build中似乎缺少php igbinary模块当我安装heroku Redis插件时,它默认为我提供
Redis\u URL
变量。难道没有任何方法可以使用该字符串,而不是将其分为主机、端口和密码,分别传递给
connect()
方法吗?看来phpredis扩展没有一个接口可以接受这种格式的连接字符串:当我安装Heroku Redis插件时,它默认为我提供
Redis\u URL
变量。除了将该字符串拆分为主机、端口和密码并分别传递给
connect()
方法之外,是否还有其他方法可以使用该字符串?似乎phpredis扩展没有一个接口可以接受这种格式的连接字符串:
$redis = new \Redis();
$redis->connect('ec2.eu-west-1.compute.amazonaws.com', 27269);
$redis->auth('someHash');