Compile and install redis extension for php7
background: Recently upgraded php to 7.0 and need to use redis extension,
sudo apt-get install php7-redis not found, can only be compiled and installed
The compilation and installation process is as follows
1 Download and decompress the source code package
<code>cd ~/download wget -c https://github<span>.com</span>/phpredis/phpredis/archive/php7<span>.zip</span> unzip php7<span>.zip</span></code>
2 Generate the .configure configuration file
<code>cd phpredis-php7 phpize <span># /usr/bin/php-config</span><span>//中间提示找不到phpize 提示此命令在php7-dev</span><span>//因此执行 sudo apt-get install php7-dev安装php7-dev</span></code>
phpize is used to extend the PHP extension module. PHP plug-in modules can be built through phpize
php-config is a A simple command line script to obtain information about the installed PHP configuration.
See more at http://php.net/manual/zh/install.pecl.php-config.php
3 make
<code><span>make</span></code>
4 make install
<code>sudo make install <span># ...省略一大段提示信息</span><span># //最后一行</span><span># Installing shared extensions: /usr/lib/php/20151012/</span></code>
/usr/lib/php/20151012/ here It is the redis extension installation directory
5 Modify php.ini
<code>gedit /etc/php/<span>7.0</span>/fpm/php<span>.ini</span></code>
Search for Dynamic Extensions
<code><span>//上下文大概长这样</span> ;<span>extension</span>=php_pdo_firebird.dll ;<span>extension</span>=php_pdo_mysql.dll ;<span>extension</span>=php_pdo_oci.dll ;<span>extension</span>=php_pdo_odbc.dll</code>
Add the redis extension path at the back
<code> extension = <span>/usr/lib</span><span>/php/</span><span>20151012</span>/redis.so</code>
Restart the php service
<code><span>sudo</span> service php7.<span>0</span>-fpm restart</code>
bingo~
').addClass('pre- numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });The above has introduced the 163 php php7 compilation and installation of the redis extension, including the content of redis and php7. I hope it will be helpful to friends who are interested in PHP tutorials.