Home >Backend Development >PHP Tutorial >ubuntu下安装phpredis的模块扩充

ubuntu下安装phpredis的模块扩充

WBOY
WBOYOriginal
2016-06-13 12:16:261051browse

ubuntu下安装phpredis的模块扩展

1.前提是先安装好redis,然后再安装phpredis。。。

2.先下载phpredis-master.tar.gz安装包。。。

具体详情如下:

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">1.tar zxvf phpredis-master.tar.gz </span></span>

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">2.cd phpredis-master/</span></span>

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">3./opt/lampp/bin/phpize ./configure --with-php-config=/opt/lampp/bin/php-config</span></span>
注意phize和php-config的路径,我的php是在lampp下面,具体路径根据你的php路径来
<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">4.sudo /opt/lampp/bin/phpize-5.5.15</span></span>
运行到这一步会出现下面问题

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">Configuring for:PHP Api Version:         20121113Zend Module Api No:      20121212Zend Extension Api No:   220121212Cannot find autoconf. Please check your autoconf installation and the$PHP_AUTOCONF environment variable. Then, rerun this script.</span></span>

这时就需要安装两个东西

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">5.sudo apt-get install m4</span></span>
如果安装过程中出现以下错误

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">dpkg: error processing package install-info (--unpack): 子进程 已安装 post-installation 脚本 返回了错误号 127在处理时有错误发生: install-infoE: Sub-process /usr/bin/dpkg returned an error code (1)</span></span>

则在这里有解决办法:http://blog.csdn.net/hearain528/article/details/44173069

然后重新安装即可成功安装m4...

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">6.sudo apt-get install autoconf</span></span>
如果也出现上面5的问题,则和第5步的解决办法一样。。。

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">7.sudo /opt/lampp/bin/phpize-5.5.15 </span></span>

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">8.sudo ./configure --with-php-config=/opt/lampp/bin/php-config</span></span>

<span style="color:#009900;"><span style="background-color: rgb(0, 0, 0);">9. sudo make</span></span>

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">10.sudo make install    Installing shared extensions: /opt/lampp/lib/php/extensions/no-debug-non-zts-20121212/    </span></span>
上面出现的路径则是redis.so的路径,然后在php.ini里面增加

<span style="color:#33CC00;"><span style="background-color: rgb(0, 0, 0);">11.extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20121212/redis.so"</span></span>

然后重启服务器,或者重启php,然后运行phpinfo.php查看phpredis扩展是否安装成功。。。


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn