Parameterize redis server IP #6101

Closed
opened 2026-01-22 15:26:47 +01:00 by admin · 4 comments
Owner

Originally created by @mayconfsbrito on GitHub (Nov 9, 2018).

Q A
Version 2.5.14

My php server has the redis extension loaded, but my redis server instance are in another server. So, when I run my app is displayed the RedisException below:

Fatal error: Uncaught exception 'RedisException' with message 'Connection refused' in /var/www/middlewares/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:200

Below the code regarding this exception:

if (extension_loaded('redis')) {
    $redis = new \Redis();
    $redis->connect('127.0.0.1');   <------ Server IP

    $cache = new \Doctrine\Common\Cache\RedisCache();
    $cache->setRedis($redis);

    return $cache;
}

So, basically it was good if the redis server IP was parameterized in Doctrine config options.

Originally created by @mayconfsbrito on GitHub (Nov 9, 2018). | Q | A |------------ | ----- | Version | 2.5.14 My php server has the redis extension loaded, but my redis server instance are in another server. So, when I run my app is displayed the RedisException below: `Fatal error: Uncaught exception 'RedisException' with message 'Connection refused' in /var/www/middlewares/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:200` Below the code regarding this exception: ```php if (extension_loaded('redis')) { $redis = new \Redis(); $redis->connect('127.0.0.1'); <------ Server IP $cache = new \Doctrine\Common\Cache\RedisCache(); $cache->setRedis($redis); return $cache; } ``` So, basically it was good if the redis server IP was parameterized in Doctrine config options.
admin added the ImprovementQuestion labels 2026-01-22 15:26:47 +01:00
admin closed this issue 2026-01-22 15:26:47 +01:00
Author
Owner

@Ocramius commented on GitHub (Nov 10, 2018):

Sorry, incorrectly moved this issue. I think the entire Doctrine\ORM\Tools\Setup is kinda foobar'd. Probably a better idea to leave this to PSR-11 providers like https://github.com/DASPRiD/container-interop-doctrine, in future.

Thoughts, @doctrine/doctrinecore?

@Ocramius commented on GitHub (Nov 10, 2018): Sorry, incorrectly moved this issue. I think the entire `Doctrine\ORM\Tools\Setup` is kinda foobar'd. Probably a better idea to leave this to PSR-11 providers like https://github.com/DASPRiD/container-interop-doctrine, in future. Thoughts, @doctrine/doctrinecore?
Author
Owner

@Ocramius commented on GitHub (Nov 10, 2018):

So, basically it was good if the redis server IP was parameterized in Doctrine config options.

I'm excluding this upfront. The if (extension_loaded('redis')) { block should rather disappear, but the setup utilities are in place to aid in getting started there, they are surely not meant to be highly configurable.

@Ocramius commented on GitHub (Nov 10, 2018): > So, basically it was good if the redis server IP was parameterized in Doctrine config options. I'm excluding this upfront. The `if (extension_loaded('redis')) {` block should rather disappear, but the setup utilities are in place to aid in getting started there, they are surely not meant to be highly configurable.
Author
Owner

@Majkl578 commented on GitHub (Nov 10, 2018):

I think the entire Doctrine\ORM\Tools\Setup is kinda foobar'd.

As discussed with @lcobucci some time ago, we should either drop the Setup class altogether in 3.0 or at least drop the magic around caching configuration - it makes a lot of naive assumptions, especially when creating the cache instance.

@Majkl578 commented on GitHub (Nov 10, 2018): > I think the entire Doctrine\ORM\Tools\Setup is kinda foobar'd. As discussed with @lcobucci some time ago, we should either drop the Setup class altogether in 3.0 or at least drop the magic around caching configuration - it makes a lot of naive assumptions, especially when creating the cache instance.
Author
Owner
@Majkl578 commented on GitHub (Nov 11, 2018): > As discussed https://github.com/doctrine/doctrine2/pull/6777#discussion_r159183945 https://github.com/doctrine/doctrine2/pull/6905#pullrequestreview-84359484
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6101