Tag Archives: Caching

WordPress, PHP and IIS setup of REDIS using Redis Object Cache Free Plugin

Note:  This presumes you already have a working REDIS server inside your LAN.  If you don’t, please see my coming post on how to set up a REDIS virtual machine on HYPER-V.

 

  1. You will need to install the php REDIS extension.  I am using IIS 10 and Windows Server 2022, so I went to this page: https://pecl.php.net/package/redis and downloaded 5.3.7 stable (as of 04-2023).
  2. Extract
  3. I am on the latest 7.4x build of PHP which is 7.4.33 as of 04-2023.  This will supposedly work fine under 8.x but I haven’t tested it inside my environment.
  4. copy the files pictured below to your PHP EXT folder.
  5. Add REDIS information into your wp-config.php file
    1. edit the file
    2. near the top of the file, add the following
    3. // adjust Redis host and port if necessary 
      define( 'WP_REDIS_HOST', 'x.x.x.x' );
      define( 'WP_REDIS_PORT', 6379 );
      
      // change the prefix and database for each site to avoid cache data collisions
      define( 'WP_REDIS_PREFIX', 'name-of-your-site' );
      define( 'WP_REDIS_DATABASE', 0 ); // 0-15
      
      // reasonable connection and read+write timeouts
      define( 'WP_REDIS_TIMEOUT', 1 );
      define( 'WP_REDIS_READ_TIMEOUT', 1 );
      define( 'WP_REDIS_SCHEME', 'tcp' );
    4. CHANGE the HOST IP to the LAN IP of your REDIS server
    5. CHANGE the PREFIX to a unique friendly name of your site
    6. CHANGE DATABASE (a number between 0 and 15, which needs to be unique and for this website only)
    7. Save changes
  6. Edit your PHP.ini file and add the following line
    1. extension=php_redis.dll
    2. save
  7. Go to the WordPress Admin
  8. Plugins, Add new Plugin
  9. Search for REDIS
  10. clock on REDIS OBJECT CACHE, click install
  11. click Activate
  12.  Look at the REDIS plugin
    1. SETTINGS->REDIS
  13. Hopefully you will see three green checkboxes, which means your REDIS cache is up and running.
  14. If you don’t have three green checkmarks as above, I am available for consultation on your project.  Please reach out to me here.