Configuration environment:
Virtual machine: VMware Workstation 12.0; System: CentOS;
Already installed php and apache
PHP
Configuration file of php: /etc /php.ini
www Directory: /var/www (The project should be placed in the html directory under www)
Apache
Apache installation path: /etc/httpd
[1] Download the installation package of phpredis
Go to http://redis.io/clients#php Download, select phpredis, click the link to download the installation package
【2】Use XftpPortable to connect to the virtual machine, and put the downloaded package through the local physical machine Go to the virtual machine system
【3】Unzip: Use tar -xzvf phpredis-develop.tar.gz command to decompress the installation package
Use tar -xzvf phpredis-develop.tar.gz command to decompress the installation package
[4] Enter the decompressed directory and use phpize Command compilation
if the following problems occur:
./configure-with-pHP-C/LOCAL/PHP/BIN/PHP- config
-bash: ./configure: No such file or directory
The error shown is due to the wrong path of php-config, use sudo find -name php -config can be found
Execute the command again: ./configure --with-php-c/bin/php-config
Create a new test.php in the /www/html directory File
<?php
echo phpinfo();
?>
If redis is displayed, it means the redis extension was successfully installed
The above introduces the installation of phpredis extension under CentOS, including centos and redis content. I hope it will be helpful to friends who are interested in PHP tutorials.