'phpredis errors Class Redis not found in Linux
I met a weied problem when installing phpredis by
cd phpredis && ./configure && make && make install
after that, I add
extension=redis.so
into php.ini.
I can get an OK by running
php -r "if (new Redis() == true){ echo \"\r\n OK \r\n\"; }"
BUT when running http:127.0.0.1, nginx throw a error " Fatal error: Class 'Redis' not found in index.php"
<?php>
$client = new Redis();
<?>
I guess this may be some problems related with environment...
Thanks for any advice!
Solution 1:[1]
I had this issue minutes ago, and I solved it restarting the server, this way the server refresh *.ini files
Solution 2:[2]
If you're using composer and get the error "Class Redis not found" try put a backslash before the name class. Like this:
<?php
$client = new \Redis();
<?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Diego Restrepo |
| Solution 2 | Rafael Marteze |
