Home  >  Article  >  Backend Development  >  在Linux安装php的curl扩展,并支持https请求,重新编译法

在Linux安装php的curl扩展,并支持https请求,重新编译法

WBOY
WBOYOriginal
2016-06-20 12:37:031361browse

环境:php5.5.5 + nginx

任务:安装php curl扩展,并支持https

血与泪之坑:我先安装了curl,发现不支持https,然后再安装openssl,然而一切都晚了,折腾了半天,还是要重装。

方法:

首先安装openssl,直接

SHELL

yum -install opensslyum -install openssl-devel

然后重新安装curl,安装完以后记得curl -V测试一下支不支持https

SHELL

wget http://curl.haxx.se/download/curl-7.24.0.tar.gztar -xzf curl-7.24.0.tar.gz cd curl-7.24.0./configure --prefix=(安装路径) --with-ssl=(ssl安装路径)makemake install

然后导出目前php的编译参数

SHELL

/usr/local/php/bin/php -i | grep configure

进入php安装文件目录,如果没有了就再下载一个

SHELL

/usr/local/php/bin/phpize./configure --with-curl=(安装路径) --with-openssl=(安装路径) //刚才导出的编译参数加上这2个makemake install

不报错的话,重启nginx和php-fpm就可以了!

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