Intall php redis on Windows Xampp Wampp to use redis session handler on php

I
  1. ### How to Check and Enable Thread Safety for Redis in PHP

    If you’re looking to enable Redis for your PHP application, it’s essential to first determine the version of Thread Safety that your PHP installation uses. Here’s a step-by-step guide to help you through the process:

    #### Step 1: Check Your PHP Thread Safety

    1. **Create a `phpinfo()` File**:
    – Create a new PHP file in a directory that your web server can access (e.g., `info.php`).
    – Add the following code to the file:
    “`php
    <?php
    phpinfo();
    ?>
    “`
    – Save the file and open it in your web browser (e.g., `http://your-server/info.php`).

    2. **Locate Thread Safety Information**:
    – Look for the section labeled “Thread Safety” on the PHP info page. It will indicate whether it is enabled or disabled.

    #### Step 2: Download the Correct Redis Version

    1. **Visit the PECL Website**:
    – Navigate to the [PECL Redis package page](https://pecl.php.net/package/redis) and find the version compatible with your PHP version. For example, if you’re using PHP 7.2, make sure to select Redis version 5.2.2 or earlier.

    2. **Select the DLL Download**:
    – Click on the appropriate version link on the right side of the page to access the Windows file download section.

    3. **Choose the Correct Version**:
    – Select the right PHP version and ensure you download the correct version based on Thread Safety: either Thread Safe (TS) or Non Thread Safe (NTS). Also, make sure to choose the correct architecture: x64 or x86.

    #### Step 3: Install the Redis Extension

    1. **Download and Extract**:
    – Once you have the DLL file, download it, and extract the contents.

    2. **Copy the Files**:
    – Place the `php_redis.pdb` and `php_redis.dll` files into the appropriate directory:
    – For **Wamp**: `C:\wamp\bin\php\php-XXXX\ext`
    – For **Laragon**: `C:\laragon\bin\php\php-XXX\ext`

    #### Conclusion

    By following these steps, you can successfully check and enable Redis support in your PHP installation based on the appropriate Thread Safety configuration. If you have any further questions or need assistance, feel free to reach out!

About the author

Matteo Lavaggi