Title: WP_CACHE_KEY_SALT useless?
Last modified: May 21, 2019

---

# WP_CACHE_KEY_SALT useless?

 *  Resolved [DCX.RS](https://wordpress.org/support/users/darktwen/)
 * (@darktwen)
 * [7 years ago](https://wordpress.org/support/topic/wp_cache_key_salt-useless/)
 * I’ve written a script to enable wp-redis for all my WP installations, on my cPanel
   server.
 *     ```
       for i in $(ls --hide='system' /var/cpanel/users/); do
         find /home/$i/public_html -name 'wp-admin' -print0 | while IFS= read -r -d $'\0' line; do
           cd $line/../;   
           randstring=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-32};echo;);
           echo "define ('WP_CACHE_KEY_SALT', '$randstring:');" >> wp-config.php;
   
           PHP_PATH="/opt/cpanel/ea-php56/root/usr/bin/php"
   
           sudo -H -u$i $PHP_PATH /home/wp core update-db;
   
           sudo -H -u$i $PHP_PATH -d "disable_functions=NULL" /home/wp plugin install wp-redis;
           sudo -H -u$i $PHP_PATH -d "disable_functions=NULL" /home/wp plugin activate wp-redis;
           rm -rfv wp-content/object-cache.php
           sudo -H -u$i $PHP_PATH -d "disable_functions=NULL" /home/wp redis enable;
           sudo -H -u$i $PHP_PATH -d "disable_functions=NULL" /home/wp redis info;
         done;  
       done
       ```
   
 * And after all went well, I realized sites started randomly redirecting to each
   other.
    Even though this random string is being added to each wp-config.php
 * `define ('WP_CACHE_KEY_SALT', 'xxxxxxxxxxxxxxxxxxxxxx:');`
 * With another plugin, redis-cache, this works perfectly, but with that plugin,
   I have problem with “You’re not authorized to view this page” and with yours,
   I do not, but I can’t use WP_CACHE_KEY_SALT.
 * Any guidance would be highly appreciated. Are there any specific requirements
   for this key value? Am I doing something wrong?
    -  This topic was modified 7 years ago by [DCX.RS](https://wordpress.org/support/users/darktwen/).
    -  This topic was modified 7 years ago by [DCX.RS](https://wordpress.org/support/users/darktwen/).
    -  This topic was modified 7 years ago by [DCX.RS](https://wordpress.org/support/users/darktwen/).
    -  This topic was modified 7 years ago by [DCX.RS](https://wordpress.org/support/users/darktwen/).
    -  This topic was modified 7 years ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
    -  This topic was modified 7 years ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [DCX.RS](https://wordpress.org/support/users/darktwen/)
 * (@darktwen)
 * [7 years ago](https://wordpress.org/support/topic/wp_cache_key_salt-useless/#post-11555846)
 * [@jdembowski](https://wordpress.org/support/users/jdembowski/) you didn’t need
   to censor salt I generated it for this topic so that author can tell me if my
   syntax is wrong or something. It’s generated using this
 * `randstring=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-32};echo;);`
    for
   each site individually.
 * `define ('WP_CACHE_KEY_SALT', 'r526JkOEUCM1vEZS1D0T9FJLlNON1xtH:');`
    -  This reply was modified 7 years ago by [DCX.RS](https://wordpress.org/support/users/darktwen/).
 *  Plugin Contributor [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [7 years ago](https://wordpress.org/support/topic/wp_cache_key_salt-useless/#post-11560087)
 * > Even though this random string is being added to each wp-config.php
 * If you add the constant to the end of the `wp-config.php` file, it won’t be loaded
   until _after_ the entire request has been processed. You need to put the constant
   at the top of `wp-config.php`.
 *  Thread Starter [DCX.RS](https://wordpress.org/support/users/darktwen/)
 * (@darktwen)
 * [7 years ago](https://wordpress.org/support/topic/wp_cache_key_salt-useless/#post-11560306)
 * That should’ve been mentioned in documentation 😀
 *  Thread Starter [DCX.RS](https://wordpress.org/support/users/darktwen/)
 * (@darktwen)
 * [7 years ago](https://wordpress.org/support/topic/wp_cache_key_salt-useless/#post-11562431)
 * Thanks, works amazing. I now activated your plugin for all my hosting customers
   😉
 * Here’s complete working bash script if anyone with cPanel server wants to do 
   this for all sites too:
 * [https://github.com/lukapaunovic/wp-redis-enable-all-installs-cpanel](https://github.com/lukapaunovic/wp-redis-enable-all-installs-cpanel)

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WP_CACHE_KEY_SALT useless?’ is closed to new replies.

 * ![](https://ps.w.org/wp-redis/assets/icon-256x256.png?rev=3417699)
 * [WP Redis](https://wordpress.org/plugins/wp-redis/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-redis/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-redis/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-redis/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-redis/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-redis/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [DCX.RS](https://wordpress.org/support/users/darktwen/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/wp_cache_key_salt-useless/#post-11562431)
 * Status: resolved