7

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

1
  • redio.so? should probably be redis.so. Fix the line in your php.ini and things should start working. Commented Jul 11, 2012 at 2:50

5 Answers 5

9

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
Sign up to request clarification or add additional context in comments.

1 Comment

Is not working, screenshot contains more info. Error = pecl/redis requires PHP (version >= 7.0.0, version <= 7.1.0, excluded versions: 6.0.0), installed version is 5.5.30. No valid packages found, install failed
9

To verify if you have got redis installed you can do this

php -m | grep redis

Comments

3

Create a file PHP with echo phpinfo(); in it and see if the module is showing up. If you do not see the module then it is not being loaded correctly.

Comments

0

In the PHP5.3 and Amazon Linux AMI (Same as Centos OS 5)

install libs

yum install php-pear php-devel make gcc wget

install redis

cd /opt/
mkdir /opt/redis
wget https://redis.googlecode.com/files/redis-2.6.14.tar.gz "or last version"
tar -zxvf redis-2.6.14.tar.gz
cd redis-2.6.14
make
make install

install php-redis by pecl

pecl install redis

configuration option "php_ini" is not set to php.ini location

You should add "extension=redis.so" to php.ini

reload the web service httpd

service httpd reload

verify that the extension has been installed

php -m
[PHP Modules]
bz2
...
**redis**
...
[Zend Modules]

Comments

0

Download the proper library file according to your server environment( ex. x86). also, check for your PHP is thread-safe or not and download the Redis library accordingly. then place the library file inside the extension folder. you need to mention the library inside your php.ini as given below.

extension=redis.dll

then restart the server once, and check it's working properly or not. if you have command line PHP, you can check it in the command line PHP as,

php r("print_r(get_loaded_extensions());")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.