Extensions in PHP are usually installed in the installation environment. But some of the extensions that you want to add later are also possible. PHP supports post-installation extensions.
To install an extension, you need to download the extended source package needed to install the extension first. Autoconf.tar.gz and phpredis.tar.gz need to leave a mailbox or +q472368077
The file is uploaded to the/usr/local/redis directory via FTP for decompression.
Locate the PHP running directory/usr/local/php/bin/, locate the executable phpize find the path, and then go back to the Phpredis directory of the Unpacked folder.
Cd/usr/local/redis/phpredis
Executive Phpize
/usr/local/php/bin/phpize
Because the normal order of installation should be to install Redis and then install PHP, now we execute the order exactly the opposite. So executing the/usr/local/php/bin/phpize command can fix the problem of the installation sequence.
Role: You can reverse-install the Redis extension into PHP.
After executing the command, you will be told that you need autoconf software dependencies, and then install autoconf
Cd..
Tar zxvf autoconf.tar.gz
CD autoconf
./configure
Make && make install
Cd..
CD Phpredis
/usr/local/php/bin/phpize
New Executive Phpize
./configure--with-php-config=/usr/local/php/bin/php-config
Configure the PHP configuration path for Redis
Make && make install
ls/usr/local/php/lib/php/extensions/no-debug-***/See if there is a redis.so (* * * for the file name in your directory)
This is the extension file for the PHP extension, which needs to be referenced in the php.ini
Cd/usr/local/php/lib This directory has a php.ini
Vim php.ini
/extension find the location of the reference file.
Adding a line extension=redis.so introducing a redis extension
: Wq Save Exit
Restart Apache/usr/local/httpd/bin/apachectl restart
After restarting, go to a php file output phpinfo () to see if the extension is installed.
The PHP extension installation of Redis in Linux