Tagged: Redis
-
AuthorPosts
-
March 6, 2023 at 1:13 pm #81621Marc ZampettiGuest
I wish to set the Redis configuration options via the wp-config.php file, since I’m running WP via Docker and want to inject the specifics as part of the startup.
I’ve modified my wp-config.php to set the various W3TC_CONFIG_CACHE_REDIS defines() appropriately, and then used the Admin UI to configure W3 Total Cache to use Redis for the various caches (Page, Database, Object).
However, I’m seeing a lot of errors in the PHP error log about connection refused related to Redis, even though I know the connection is possible. If When I set the Cache to use Redis, that adds the Redis Settings UI to the Cache config page in the Admin console. But the settings displayed there are the defaults.
How do I ensure that W3TC is using the configs from the wp-config.php file? If I had configured the settings in the past via the Admin UI, how do I remove them?
March 6, 2023 at 1:17 pm #81878Marko VasiljevicKeymasterHello Marc,
Thank you for reaching out and I am happy to assist you with this.
W3 Total Cache recognizes PHP modules so you need a Redis PHP extension installed in order to be able to select Redis in W3TC.
Can you please confirm this?
Thanks!March 9, 2023 at 9:19 am #82051Marc ZampettiGuestI have the correct Redis PHP module installed, and W3TC IS using Redis once I configure it via the Admin UI. But as it currently stands, I can use Redis as the cache implementation for at least 4 different portions of the W3TC logic, Page Cache, Object Cache, Database Cache, and Minify Cache. It appears that I have to configure the redis connection information for each one of these things separately, which is not ideal. Also, we use Redis Authentication for access to our Redis host, so I need to enter the Redis AUTH token. The W3TC Admin UI doesn’t hide this information, so anyone that has access to the Admin UI can see what this token is. That is a security risk.
So what I’m asking is how can I configure the Redis connection information via config files, ideally the wp-config.php file. This way, i can inject the correct credentials and connection information when I launch WP (we are running WP via Docker containers).
Note: I already have read through the code and the wiki pages, and while they are helpful, they don’t answer my specific question, and it appears when I just configure the various W3TC_CONFIG_CACHE_REDIS_* variables in wp-config.php, they are not picked up.
OR, the plugin is trying to use the values that were stored in the database since I initially entered the options through the Admin UI, but once I configured the values in wp-config.php, I tried to remove the options from the Admin UI, but there doesn’t appear to be any way to do that. If there is, please let me know.
March 15, 2023 at 9:02 am #82699Marc ZampettiGuestIs there any information that can be supplied to help with this issue? How can I force the use of the wp-config.php file for the Redis connection information instead of the fields in each of the Admin UI sections of the W3TC plugin.
March 24, 2023 at 11:03 am #83774Marko VasiljevicKeymasterHello Marc,
Sorry for the late reply.
There is no option to do this via the wp-config.php file. You can try is adding db-config.php
Please check more details on our wiki page.
Thanks!April 3, 2023 at 12:37 pm #84438Marc ZampettiGuestMarko,
I’ve read the wiki page, and it doesn’t make a lot of sense. First, the wiki page says to create a file in the path w3-total-cache/ini/db-config.php with the REDIS settings, but there is a file in w3-total-cache/ini/config-db-sample.php that has the same settings. That would imply that the name should be config-db.php, and not db-config.php. So which is it? But either way, I cannot find any reference to either of those files in the rest of the W3 Total Cache PHP code. How and when is that file loaded and referenced.
And even more strange, this bug https://github.com/BoldGrid/w3-total-cache/issues/337 specifically states that putting those settings in wp-config.php will work.
But then the other issue is that the config-db-sample.php sets the value:
define( ‘W3TC_CONFIG_DATABASE’, true );
Which causes the configuration to be stored in the database. I don’t want that. I need to be able to inject the configuration into the runtime when PHP is executed, since it could change over time.
So how am I supposed to make that happen?
-
AuthorPosts
- The topic ‘Redis Config’ is closed to new replies.