PHP redis error

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 a new version of phpredis.

May I get your help? THANKS!

Installation steps are:

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

Then add the configuration file to / etc / php 5 / fpm / confi.d to load redis.so

+7
source share
5 answers

I am using PHP 5.3 and installing PHP-Redis using the steps below that work fine for me:

  • Install extension for sudo pecl install redis
  • In php.ini you may need to set extension_dir to correct the value. (may be usr/lib64/php/modules , as stated above, put redis.so in this directory). In my case, I did not ask this.
  • Add the line below php.ini :
    extension=redis.so
  • Restart Apache / PHP-FPM
+9
source

To make sure you have redis installed, you can do this

php -m | grep redis

+5
source

Create a PHP file with echo phpinfo (); in it and see if the module appears. If you do not see the module, it does not load correctly.

+3
source

In 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 key

 pecl install redis 

php_ini configuration parameter not set to php.ini location

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

reload httpd web service

 service httpd reload 

make sure the extension is installed

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

Download the appropriate library file according to your server environment (e.g. x86). Also, check that your PHP is thread safe or not, and download the Redis library accordingly. then put the library file in the extension folder. you need to specify the library inside your php.ini as below.

 extension=redis.dll 

then restart the server once and make sure that it is working correctly or not. if you have a PHP command line, you can check it in the PHP command line,

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

Source: https://habr.com/ru/post/920176/


All Articles