ubuntu14.04升级php curl,支持http2发送APNs

网上升级很多都不完整,不是这里出错就是那里出错。

遇到的问题是:

一、首先升级curl,这个比较容易,虽然支持http2,但是利用命令发送不了APNs的消息,明明支持http2,可以发送消息的头部依然是http/1.1。找了很多资料,需要升级openssl

二、升级openssl也容易,但是编译了很多次,curl -V查看版本的时候,openssl依然是老版本

总结问题,要cURL支持http2,必须满足openssl >= 1.0.2 , cURL >= 7.46.0

安装库文件

sudo apt-get install g++ make binutils autoconf automake git autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libxml2-dev libev-dev libevent-dev libssl-dev libjansson-dev libjemalloc-dev cython python3-dev python-setuptools

1、升级openssl

sudo add-apt-repository ppa:0k53d-karl-f830m/openssl

sudo apt-get update

sudo apt-get install openssl

2、安装nghttp2

git clone https://github.com/tatsuhiro-t/nghttp2.git

cd nghttp2

autoreconf -i

automake

autoconf

./configure

make

sudo make install

3、升级curl

sudo apt-get build-dep curl

wget https://curl.haxx.se/download/curl-7.55.1.tar.gz

tar zxvf curl-7.55.1.tar.gz

cd curl-7.55.1

./configure --prefix=/usr/local --with-nghttp2=/usr/local --with-ssl

make -s && sudo make install

sudo ldconfig

4、升级php5-curl

apt-get remove php5-curl

apt-get install php5-curl

php5enmod curl

service apache2 restart
标签:CurlUbuntuPHP 发布于:2019-11-08 13:09:33