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.

 

Why Enable Redis?

  • 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【edge_current_page_context†source】.

 

Steps to Enable Redis Extension for PHP

1. Check PHP Version

  • 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).

2. Enable Redis via PHP Selector

  • In Select PHP Version, look for the redis extension in the list.

  • Check the box next to redis.

  • Click Save to apply changes.

3. Verify Redis Installation

  • 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.

4. Configure Redis in Your Application

  • 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);
      

       

5. Test Redis Connection

  • 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.

 

Notes

  • Redis must be running on the server for the PHP extension to connect.

  • On shared hosting, Redis may be enabled globally by ruachost.com administrators.

  • Always restart PHP‑FPM after enabling new extensions.

Ha estat útil la resposta? 0 Els usuaris han Trobat Això Útil (0 Vots)

Powered by WHMCompleteSolution