Skip to content

Enabling the Redis extension for PHP

Redis is an in‑memory data structure store often used as a cache or session handler to improve application performance. To use Redis with PHP applications (like Laravel, WordPress, or Magento) on ruachost.com, you need to enable the Redis extension.

  • Provides faster caching and session management.
  • Reduces database load by storing frequently accessed data in memory.
  • Improves scalability for high‑traffic websites.
  • Compatible with all ruachost.com hosting accounts.
  • Log in to cPanel at ruachost.com.
  • Go to Select PHP Version under the Software section.
  • Confirm your PHP version supports Redis (PHP 7.4+ recommended).
  • In Select PHP Version, look for the redis extension in the list.
  • Check the box next to redis.
  • Click Save to apply changes.
  • Create a phpinfo.php file in your public_html directory:

    <?php phpinfo(); ?>
  • Visit http://example.com/phpinfo.php.

  • Search for redis in the output.

  • If enabled, you’ll see Redis extension details.

  • For Laravel:

    • Update .env file:

      CACHE_DRIVER=redis
      SESSION_DRIVER=redis
      REDIS_HOST=127.0.0.1
      REDIS_PASSWORD=null
      REDIS_PORT=6379
  • For WordPress:

    • Install a Redis plugin (e.g., Redis Object Cache).

    • Add to wp-config.php:

      define('WP_REDIS_HOST', '127.0.0.1');
      define('WP_REDIS_PORT', 6379);
  • Run a simple PHP script:

    <?php
    $redis = new Redis();
    $redis->connect('127.0.0.1', 6379);
    echo "Connection to Redis successful!";
    ?>
  • If successful, Redis is ready for use.