时间:2021-07-01 10:21:17 帮助过:21人阅读
体验RPC框架Yar需要:
1. 装二进制打包协议msgpack
2. 装yar拓展和依赖
一. 安装二进制打包协议msgpack
1. 安装PHP拓展包有很多种方式,当然没什么是比pecl更加来得暴力,用这个之前要确认phpize是否存在
find / -name phpize
2. 如果phpize不存在
yum install php-devel
3. Ok,先装msgpack
pecl install msgpack
安装跳了一大堆编译过程过程,省略ING 只关心后几行
Build process completed successfully Installing '/usr/include/php/ext/msgpack/php_msgpack.h' Installing '/usr/lib64/php/modules/msgpack.so' install ok: channel://pecl.php.com/msgpack-0.5.6 configuration option "php_ini" is not set to php.ini location You should add "extension=msgpack.so" to php.ini
安装完 msgpack.so 会自动复制到 php 扩展库,并写好配置。
二. 安装 yar
1. 下载 yar
wget http://pecl.php.com/get/yar-2.0.0.tgz
2. 解压编译
tar -zxvf yar-2.0.0.tgz cd cd yar-2.0.0 /usr/bin/phpize ./configure --with-php-config=/usr/bin/php-config7.0*
遇到问题:
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
3. 安装 curl-devel
yum -y install curl-devel sudo apt-get install libcurl4-gnutls-dev
ps:curl vs curl-deval
参考: http://stackoverflow.com/questions/4976971/compiling-php-with-curl-where-is-curl-installed
4. 安装 yar
make && make install
5. 复制 yar.so 到 php 扩展库下
sudo cp yar.so /usr/lib/php/20151012/yar.so
6. 扩展写配置文件
echo "extension=yar.so" > /etc/php/7.0/mods-available/yar.ini ln -sf /etc/php/7.0/mods-available/yar.ini /etc/php/7.0/fpm/conf.d/20-yar.ini ln -sf /etc/php/7.0/mods-available/yar.ini /etc/php/7.0/cli/conf.d/20-yar.ini
7. 重启 php-fpm nginx
service php7.0-fpm restart service nginx restart
ps: php -ir 查询 phpinfo
相关推荐:
分享在PHP 7下安装Swoole与Yar,Yaf的方法教程
yar框架的并行原理分析(libcurl+epoll)
yarn是什么?yarn是如何代替npm管理前端项目模块依赖的?
以上就是全面解析php7安装yar扩展的方法的详细内容,更多请关注Gxl网其它相关文章!