using Redis with PHP
installation
Please install the php-devel before installation
$ yum Install Php-devel $ wget https://github.com/phpredis/phpredis/archive/2.2.4.tar.gz $ tar zxf 2.2.4.tar.gz $ cd ph predis-2.2.4 $/usr/bin/phpize
If There is a problem with/usr/local/bin/phpize execution, you can use whereis phpize to find phpize Where are the directories listed as
Whereis phpize
$./configure--with-php-config=/usr/bin/php-config
If there is a problem with the./configure--with-php-config=/usr/bin/php-config execution, you can use Whereis php-config to find the Php-config column as
Whereis Php-config
At last
Make && make install
finally let PHP load Redis extensions first open php.ini if you don't know, use Whereis php.ini to find
Vi/etc/php.ini Add the following on any line of php.ini extension=redis.so add complete save and restart Apache server Systemctl restart httpd in Apach E in the domain name of the new PHP file in the input phpinfo () view
<?php $redis = new Redis (); $redis->connect (' 192.168.1.211 ', 6379); $redis->set (' key ', ' Val '); echo $redis->get (' key '); ?>
This article is from the "only" blog, please make sure to keep this source http://dadoubi.blog.51cto.com/12054595/1852445
Using Redis with PHP