php 编译安装curl 扩展

php 编译安装curl 扩展问题:线上运行的lamp服务器,默认yum安装的curl模块只支持http,不支持https。解决方法:编译安装curl,重新编译php,使php的curl模块支持https。具体步骤:1、下载curlcd/usr/local/src#进入安装包存放目录wgethttp://curl.haxx.se/download/curl-7.44.0.tar.gz#下载2、安装curlcd/usr/local/srctarzxvfcurl-7.44.0.tar..

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

转载地址:https://www.osyunwei.com/archives/9254.html

问题:

线上运行的lamp服务器,默认yum安装的curl模块只支持http,不支持https。

解决方法:

编译安装curl,重新编译php,使php的curl模块支持https。

具体步骤:

1、下载curl

cd /usr/local/src  #进入安装包存放目录

wget http://curl.haxx.se/download/curl-7.44.0.tar.gz  #下载

2、安装curl

cd /usr/local/src

tar zxvf curl-7.44.0.tar.gz  #解压

cd curl-7.44.0  #进入包安装目录

./configure –prefix=/usr/local/curl –with-gssapi –enable-tls-srp –with-libmetalink  #配置

make  #编译

make install  #安装

3、重新编译php

查找系统之前的php编译参数

   #查看php编译参数

如下:

‘./configure’ ‘–prefix=/usr/local/php’ ‘–with-config-file-path=/usr/local/php/etc’ ‘–with-apxs2=/usr/local/apache/bin/apxs’ ‘–with-mysql=/usr/local/mysql’ ‘–with-mysqli=/usr/local/mysql/bin/mysql_config’ ‘–with-mysql-sock=/tmp/mysql.sock’ ‘–with-pdo-mysql=/usr/local/mysql’ ‘–with-gd’ ‘–with-png-dir=/usr/local/libpng’ ‘–with-jpeg-dir=/usr/local/jpeg’ ‘–with-freetype-dir=/usr/local/freetype’ ‘–with-xpm-dir=/usr/’ ‘–with-zlib-dir=/usr/local/zlib’ ‘–with-t1lib=/usr/local/t1lib’ ‘–with-iconv’ ‘–enable-libxml’ ‘–enable-xml’ ‘–enable-bcmath’ ‘–enable-shmop’ ‘–enable-sysvsem’ ‘–enable-inline-optimization’ ‘–enable-mbregex’ ‘–enable-mbstring’ ‘–enable-ftp’ ‘–enable-gd-native-ttf’ ‘–with-openssl’ ‘–enable-pcntl’ ‘–enable-sockets’ ‘–with-xmlrpc’ ‘–enable-zip’ ‘–enable-soap’ ‘–without-pear’ ‘–with-gettext’ ‘–enable-session’ ‘–with-mcrypt’ ‘–with-curl ‘ ‘–enable-ctype’

对参数进行修改:

如下

./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-apxs2=/usr/local/apache/bin/apxs –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-mysql-sock=/tmp/mysql.sock –with-pdo-mysql=/usr/local/mysql –with-gd –with-png-dir=/usr/local/libpng –with-jpeg-dir=/usr/local/jpeg –with-freetype-dir=/usr/local/freetype –with-xpm-dir=/usr/ –with-zlib-dir=/usr/local/zlib –with-t1lib=/usr/local/t1lib –with-iconv –enable-libxml –enable-xml –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –enable-mbregex –enable-mbstring –enable-ftp –enable-gd-native-ttf –with-openssl –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-gettext –enable-session –with-mcrypt –with-curl=/usr/local/curl –enable-ctype

备注:修改部分

系统运维 www.osyunwei.com 温馨提醒:系统运维原创内容©版权所有,转载请注明出处及原文链接

取消原来的–with-curl

替换为:–with-curl=/usr/local/curl

取消参数两边的单引号

其它不变

cd /usr/local/src/php #进入php安装包目录(注意php版本要和之前一样)

./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-apxs2=/usr/local/apache/bin/apxs –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-mysql-sock=/tmp/mysql.sock –with-pdo-mysql=/usr/local/mysql –with-gd –with-png-dir=/usr/local/libpng –with-jpeg-dir=/usr/local/jpeg –with-freetype-dir=/usr/local/freetype –with-xpm-dir=/usr/ –with-zlib-dir=/usr/local/zlib –with-t1lib=/usr/local/t1lib –with-iconv –enable-libxml –enable-xml –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –enable-mbregex –enable-mbstring –enable-ftp –enable-gd-native-ttf –with-openssl –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-gettext –enable-session –with-mcrypt –with-curl=/usr/local/curl –enable-ctype   #配置

make #编译

make install #安装

4、重启apache使设置生效

service httpd restart #重启

故障解决!

5、测试

以下代码,保存为phpinfo.php

<?php

phpinfo();

?>

上传到网站目录,查找curl,如下图所示,说明安装成功!

php 编译安装curl 扩展

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/194132.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • tcp udp 的区别_反映和反应的区别

    tcp udp 的区别_反映和反应的区别一、TPC/IP协议是传输层协议,主要解决数据如何在网络中传输,而HTTP是应用层协议,主要解决如何包装数据。关于TCP/IP和HTTP协议的关系,网络有一段比较容易理解的介绍:“我们在传输数据时,可以只使用(传输层)TCP/IP协议,但是那样的话,如果没有应用层,便无法识别数据内容,如果想要使传输的数据有意义,则必须使用到应用层协议,应用层协议有很多,比如HTTP、FTP、TE…

    2022年9月20日
    2
  • phpMyAdmin安装图解教程

    phpMyAdmin安装图解教程 先下载一份最新版的phpMyAdminMYSQL管理器,点击下载phpMyAdmin解压后得到一个phpMyAdmin的目录(你可以改名)找到/libraries/config.default.php文件(旧版本是根目录下的config.inc.php文件),用写字板(不要用记事本,这是UTF8编码)进行编辑。找到$cfg['PmaAbsoluteUri']

    2022年5月31日
    107
  • php小程序开发完整教程_微信小程序request封装

    php小程序开发完整教程_微信小程序request封装flyio:一个支持所有JavaScript运行环境的基于Promise的、支持请求转发、自动转换JSON、支持请求/响应拦截器、强大的http请求库。可以让您在多个端上尽可能大限度的实现代码复用。flyio官方文档flyio下载地址原生微信小程序中使用flyio请求,封装代码如下一、在src/utils下新建request.js文件,文件代码如下:/*flyio:一个支持所有JavaScript运行环境的基于Promise的、支持请求转发、强大的http请求库。可以让您在多

    2025年10月4日
    3
  • HDU 1085-Holding Bin-Laden Captive!(生成功能)

    HDU 1085-Holding Bin-Laden Captive!(生成功能)

    2022年1月12日
    44
  • VMware 虚拟机如何连接网络「建议收藏」

    VMware 虚拟机如何连接网络「建议收藏」ps:本教程是针对虚拟机NAT模式连接网络一、首先查看自己的虚拟机服务有没有开启,选择电脑里面的服务查看;1.计算机点击右键选择管理2.进入管理选择VM开头的服务如果没有开启的话就右键开启二、虚拟机服务开启后就查看本地网络虚拟机的网卡启动没有1.电脑右下角网络标志右键进入网络和共享中心2.点击更改适配器,查看虚拟机的虚拟网卡启动没有,没有启动的话右键点击启动3.网卡开启后设置ip地址

    2022年4月20日
    2.8K
  • JPA 逻辑删除

    JPA 逻辑删除为了避免每次在查询的时候加上是否删除字段,做了一下封装。@NoRepositoryBean@RepositoryRestResource(exported=false)publicinterfaceBaseRepository<TextendsBaseEntity,IdTextendsLong>extendsJpaRepository<T…

    2022年6月2日
    292

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号