Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)
How to check whether my Redis server is running?

If it's not working, so I am not able to use the database.

I'm using this FuelPHP framework, so I am open to the solution based on this, or just standard PHP.

1 Answer

0 votes
by (36.8k points)

What you can do is try to get the instance (\Redis::instance()) and work with it like this:

try

{

    $redis = \Redis::instance();

    // Do something with Redis.

}

catch(\RedisException $e)

{

    // Fall back to other db usage.

}

You'd know whether Redis is running or not. This is just a way to detect it on the fly.

Want to be a Linux expert? Come and join this Linux course

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...