Enabling Redis for PHP on Synology NAS (Manual Method)

From munkjensen.net/wiki
Revision as of 16:59, 11 May 2025 by Admin (talk | contribs) (Created page with "= Enabling Redis for PHP on Synology NAS (Manual Method) = This page describes how to manually enable Redis support for PHP (v8.2) on a Synology NAS using the built-in PHP package and Docker-based Redis server. == Background == Synology does not officially include the `redis` PHP extension in its default PHP packages. Attempting to use Redis from PHP results in the following fatal error: <syntaxhighlight lang="php"> Fatal error: Uncaught Error: Class "Redis" not found...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Enabling Redis for PHP on Synology NAS (Manual Method)

This page describes how to manually enable Redis support for PHP (v8.2) on a Synology NAS using the built-in PHP package and Docker-based Redis server.

Background

Synology does not officially include the `redis` PHP extension in its default PHP packages. Attempting to use Redis from PHP results in the following fatal error:

Fatal error: Uncaught Error: Class "Redis" not found

Prerequisites

  • PHP 8.2 installed from Synology Package Center.
  • A running Redis server (e.g., using Docker or a separate host).
  • SSH access to your Synology NAS.
  • Redis PHP extension installed manually or available (e.g., copied from PECL build).

Solution

To make Synology's PHP interpreter recognize the Redis extension, you need to manually add it to the `extension_list.json` file used by Synology’s PHP infrastructure.

Steps

  1. SSH into your NAS.
  2. Open the PHP 8.2 extension configuration file:
sudo vi /volume1/@appstore/PHP8.2/misc/extension_list.json
  1. Add the following block at the end of the JSON list (inside the outermost `{}`):
    ,
    "redis": {
        "enable_default": false,
        "desc": "This module is not officially supported by Synology and may be removed by updates"
    }
  1. Save the file and exit the editor.

Important Notes

  • The Redis extension must already be available in the appropriate PHP `ext` directory (e.g., `/var/packages/PHP8.2/target/usr/local/lib/php82/modules/redis.so`).
  • After modifying `extension_list.json`, go to **Web Station** or **PHP Settings** and enable the `redis` extension.
  • This configuration may be **overwritten by DSM updates**, so it should be re-checked after system upgrades.

Source

Synology Community Forum thread: https://community.synology.com/enu/forum/69/post/161908

Status

Tested working as of May 2025 on DSM 7.x and PHP 8.2.