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

Redis extension cannot be loaded in PHP

王林
Release: 2023-04-07 18:56:01
Original
2620 people have browsed it

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)
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

Note:

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

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

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template