Docs Home Return to Homepage
Get Started Login

How to Speed Up WordPress with Redis Object Cache in DirectAdmin

Last updated Changelog

On this page

Redis keeps frequently used data in memory, so WordPress doesn’t have to ask the database for the same things on every page view. NameCrane’s DirectAdmin hosting includes your own private Redis, with a start/stop switch right in DirectAdmin. There are three parts: start Redis, switch on PHP’s redis extension, and tell WordPress to use it.

Part 1: Start Redis

  1. Log in to DirectAdmin. In the Extra Features section, click Redis Object Cache.

    The DirectAdmin Extra Features section with Redis Object Cache highlighted

  2. The Status shows Stopped. Click Start Redis Object Cache.

    The Redis Object Cache page showing Status: Stopped and the Start button highlighted

  3. The status changes to Running. Note the Socket Path, which is how apps connect to your Redis. It’s /home/yourusername/.redis/redis.sock, with your own DirectAdmin username.

    Status: Running and the socket path highlighted

Part 2: Switch on PHP’s redis extension

  1. Go back to the dashboard and open Select PHP version (in Extra Features). On the Extensions tab, tick redis. It saves straight away, and also turns on igbinary and msgpack, which it needs.

    The PHP Selector Extensions tab with redis ticked

Part 3: Connect WordPress

  1. Open your site’s wp-config.php in File Manager. For your main domain it’s in domains/yourdomain.com/public_html. Edit it, and just above the line /* That's all, stop editing! Happy publishing. */, add these two lines, using your own DirectAdmin username. Then save.

    php
    define( 'WP_REDIS_SCHEME', 'unix' );
    define( 'WP_REDIS_PATH', '/home/yourusername/.redis/redis.sock' );
    

    Warning: wp-config.php also contains your database password. Don’t share screenshots of the whole file.

  2. Log in to WordPress and go to Plugins › Add New Plugin. Search for Redis Object Cache (by Till Krüss) and click Install Now.

    The WordPress plugin search with Redis Object Cache and its Install Now button highlighted

  3. Click Activate.

    The Activate button highlighted on the Redis Object Cache plugin

  4. Go to Settings › Redis and click Enable Object Cache.

    The Redis Object Cache settings page with Enable Object Cache highlighted

  5. The Status now shows Connected, and Client shows PhpRedis. Your site is now using Redis.

    Status: Connected and Client: PhpRedis highlighted on the plugin’s Overview tab

Tip: If you change plugins or content and something looks out of date, click Flush Cache on the same page.

Troubleshooting

Problem What to do
The plugin says Not connected Check Redis shows Running in DirectAdmin, and that WP_REDIS_PATH matches your Socket Path exactly, including your username.
Client shows Predis instead of PhpRedis It still works, just a little slower. Tick redis under Select PHP version › Extensions for the faster client.
My site shows an error after editing wp-config.php Check you copied both lines exactly, including the quotes and semicolons, and that they’re above the “stop editing” line.
Redis stopped Click Start Redis Object Cache again. You can also stop it there if you no longer need it.

Snagged on something? Contact support and we’ll get you sorted.

Snagged on something?

Our sysadmins answer tickets around the clock.