Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 996
kaitian521 Avatar asked Jul 21 '14 06:07

kaitian521


2 Answers

The command line probably does not use the same php.ini file than the web server. Use phpinfo(); to know which configuration file is loaded in both cases and then declare your extension in the ini file used by your web server.

like image 87
Pascal Le Merrer Avatar answered Oct 15 '22 09:10

Pascal Le Merrer


I had this issue minutes ago, and I solved it restarting the server, this way the server refresh *.ini files

like image 45
Diego Restrepo Avatar answered Oct 15 '22 08:10

Diego Restrepo