This article will introduce to you the solutions to the failure to initialize the redis extension when installing PHP. I hope these methods will be helpful to all my friends.
The error message is as follows:
PHP Warning: PHP Startup: redis: Unable to initialize module
Module compiled with module API=20050922
PHP compiled with module API=20090626
These options need to match in Unknown on line 0
First let’s talk about the reason why this error occurs:
This is caused by the inconsistency between the version of phpize executed when compiling the source code package and the version of phpize in the current PHP environment
Solution:
1. Delete the compiled source code package phpredis-master and redis.so in the corresponding directory and re-decompress phpredis-master
2. Check whether there are php php-config php-cgi phpize files in the /usr/sbin directory. If they exist, delete these files and re-establish the corresponding soft connections to this directory
ln -s php /usr/local/php/bin/php
ln -s php-cgi /usr/local/php/bin/php-cgi
ln -s php-config /usr/local/php/bin/php-config
ln -s phpize /usr/local/php/bin/phpize
Please refer to the current installation directory of php for the above directory
3. Re-enter the phpredis-master directory to install