All eyes on AI: 2026 predictions – The shifts that will shape your stack.

Read now
For developersPHP
Ajeet Raina
Ajeet Raina
Find tutorials, examples and technical articles that will help you to develop with Redis and PHP.

#Getting Started

In order to use Redis with PHP you will need a PHP Redis client. In the following sections, we will demonstrate the use of PhpRedis, a flexible and feature-complete Redis client library for PHP. Additional PHP clients for Redis can be found under the PHP section of the Redis Clients page.
Redis is an open source, in-memory, key-value data store most commonly used as a primary database, cache, message broker, and queue. Redis cache delivers sub-millisecond response times, enabling fast and powerful real-time applications in industries such as gaming, fintech, ad-tech, social media, healthcare, and IoT.

#Step 1. Run a Redis server

Follow the instructions in the Redis quick start to get setup with Redis. The rest of this tutorial expects you to have Redis setup and ready to use. You will need the connection string.

#Step 2. Get pecl

#Step 3. Install PhpRedis

#Step 4. Opening a Connection to Redis Using PhpRedis

The following code creates a connection to Redis using PhpRedis
Replace the following values with those of your database and save this file as connect.php.

#Step 5. Executing the script

It should display "PONG" as output. You can verify this by running the monitor command

#Further Reference