First step: Before you start using Redis in PHP, we need to make sure that you have the Redis driver installed, and that you can use PHP properly on your machine. Next let's install the PHP redis driver//redis extended Download address sometimes may not link up after all it is someone else's download source [root@localhost wengpengle]# wget HTTPS://GITHUB.COM/PHPR edis/phpredis/archive/2.2.8.tar.gz//Unpack just download the good compressed package [root@localhost wengpengle]# TAR-ZXVF 2.2.8.tar.gz/Enter the main directory &N Bsp [root@localhost wengpengle]# CD phpredis-2.2.8///completion of this step (generate configure configuration file with Phpize) The following error can be seen according to the error hint no php-devel this extension Exhibition [root@localhost phpredis-2.2.8]#/usr/bin/phpize Can ' t find PHP headers in/usr/include/php the Php-devel package
is required to use the This command. //installation Php-devel will have the following prompts [root@localhost phpredis-2.2.8]# yum install Php-devel Another app is currently holding The Yum lock; Waiting for it to exit ... Another application is: PackageKit Memory: 147 M RSS (477 MB VSZ) started: Sun Aug 14 18:35:24 2016-58:34 status : Sleep, Process id:3620//kill process [Root@localhost phpredis-2.2.8]# Kill-9 3620//Continue installation php-Devel If you are prompted to have a process, continue to kill, know that there is no hint. If you do not have a hint, according to download prompts, all the way belong to Y can [root@localhost phpredis-2.2.8]# yum Install Php-devel//The following prompts represent installation success installed: php- Devel.x86_64 0:5.4.16-36.3.el7_2
be installed as dependencies: pcre-devel.x86_64 0:8.32-15.el7_2.1 As dependencies are upgraded: pcre.x86_64 0:8.32-15.el7_2.1 & Nbsp;
finished. In the execution of the/usr/bin/phpize, meaning that (generate configure configuration file with Phpize), the following prompts, instructions OK [root@localhost phpredis-2.2.8]#/USR/BIN/PHPI Ze Configuring for:php API version: 20100412 Zend Module API No: 20100525 Zend Extension Api no: 220100525//view php-config path [Root@lo Calhost phpredis-2.2.8]# whereis php-config php-config:/usr/bin/php-config/usr/share/man/man1/php-config.1.gz// Configure [root@localhost phpredis-2.2.8]#./configure--with-php-config=/usr/bin/php-config//Compile and install, (the following hints are OK) [roo
T@localhost phpredis-2.2.8]# make && make instll build complete.
Don ' t forget to run ' make test '. Installing shared extensions: /usr/lib64/php/modules///Modify php.ini configuration file to allow PHP to support Redis [root@localhost phpredis-2.2.8] #vi/etc/php.i NI//On the last line of PHP.ini plus extension=redis.so;
directive because it is not set or is mistyped, a default value would be used. Extension=redis.so (plus); The value can be a string, a number, a PHP constant (e.g. E_all or M_PI), one; The INI constants (on, off, True, False, Yes, No and None) or expression; (e.g. E_all & ~e_notice), a quoted string ("Bar"), or a reference to A; Previously set variable or directive (e.g. ${foo}); Expressions in the INI file are limited to bitwise operators and parentheses:; | bitwise OR; ^ bitwise XOR; & bitwise AND:WQ (Save and exit)///If the lamp is installed in the environment, restart Apache [root@localhost etc]# systemctl Restart/
/If you are installing a LNMP environment, restart PHP-FPM [root@localhost html]# systemctl restart complete.