Home  >  Article  >  Backend Development  >  Redis extension cannot be loaded in PHP

Redis extension cannot be loaded in PHP

王林
王林Original
2019-11-08 11:26:272546browse

Redis extension cannot be loaded in PHP

Problem:

During the process of restarting php-fpm, the following error occurred and redis.so could not be loaded

[root@brand009 modules]# /usr/sbin/php-fpm
/usr/sbin/php-fpm: /usr/lib64/libssl.so.10: no version information available (required by /usr/sbin/php-fpm)
/usr/sbin/php-fpm: /usr/lib64/libcrypto.so.10: no version information available (required by /usr/sbin/php-fpm)
/usr/sbin/php-fpm: /usr/lib64/libcrypto.so.10: no version information available (required by /usr/sbin/php-fpm)

Solution:

1. Use php --version to check the PHP version. It is 5.6.6

php --version
PHP 5.6.6 (cli) (built: Mar 9 2015 13:27:38) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

2. This php-fpm The version is found to be 5.3.3

$/usr/sbin/php-fpm -v
PHP 5.3.3 (fpm-fcgi) (built: Oct 30 2014 20:14:56)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

3, and the php-fpm version integrated within PHP is 5.6.6

$ /usr/local/php/sbin/php-fpm -v
PHP 5.6.6 (fpm-fcgi) (built: Mar 9 2015 13:27:55)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

Error reason:

php -fpm version is inconsistent with php version.

Restart with php-fpm integrated inside PHP, successful!

root   18442   1 0 17:36 ?    00:00:01 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
nobody  30640 18442 0 18:04 ?    00:00:02 php-fpm: pool www     
nobody  31156 18442 0 18:05 ?    00:00:02 php-fpm: pool www     
nobody  32424 18442 0 18:08 ?    00:00:02 php-fpm: pool www

Note:

Be sure to configure extension_dir and extension in php.ini, such as:

extension_dir = "/usr/lib64/php/modules/"
extension=redis.so

The redis.so compiled by phpredis is also It needs to be copied to "/usr/lib64/php/modules/";

"/etc/php.d/" also needs to be soft-linked to redis.so, and a redis.ini must be created. file, the content is as follows:

You can also install phpredis through the command:

pecl install redis

Recommended tutorial: PHP video tutorial

The above is the detailed content of Redis extension cannot be loaded in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn