Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP redis error

Tags:

php

redis

I installed the php redis extension. But when I run the test code, I got the following error:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/redio.so' - /usr/lib/php5/20090626+lfs/redio.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error:  Class 'Redis' not found in /var/www/test/redisTest.php on line 2

My php version is 5.3.10, I installed the new version of phpredis.

May I get your help? THANKS!

The install steps are:

git clone https://github.com/nicolasff/phpredis.git
cd phpredis
 phpize
make 
make install

Then add a config file in /etc/php5/fpm/confi.d to load redis.so

like image 656
user1321109 Avatar asked Jul 11 '12 02:07

user1321109


People also ask

What is php redis?

Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, and sorted sets. Before using Redis with Laravel, we encourage you to install and use the phpredis PHP extension via PECL.


1 Answers

I use PHP 5.3 and installing PHP-Redis using below steps worked just fine for me:

  • Install pecl extension
    sudo pecl install redis
  • In php.ini, you may need set extension_dir to correct value. (can be usr/lib64/php/modules as above command placed the redis.so in this directory). In my case, I didn't set this.
  • Add below line to php.ini:
    extension=redis.so
  • Restart Apache/PHP-FPM
like image 147
Manu Manjunath Avatar answered Sep 20 '22 13:09

Manu Manjunath