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..


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)
全栈程序员-站长的头像全栈程序员-站长

相关推荐

  • SQL Server 2005“备份集中的数据库备份与现有的数据库不同”解决方法

    SQL Server 2005“备份集中的数据库备份与现有的数据库不同”解决方法以前一直使用SQLServer2000,现在跟潮流都这么紧,而且制定要求使用SQLServer2005,就在现在的项目中使用它了。 对于SQLServer2005,有几个地方是要注意的,比方在还原数据库时,不像2000里边将数据库和文件区分的很细,统一均为文件,这就使还原的数据库文件制定为.bak。那么想还原2000的数据库(备份数据库文件,无后缀名的),就需要自己手工选择。

    2022年5月26日
  • 关于颜色的十六进制对照表图片_84的十六进制

    关于颜色的十六进制对照表图片_84的十六进制关于颜色的十六进制对照表便于查找ctrl+F调色板文字查找颜色英文代码形象描述十六进制RGBLightPink浅粉红#FFB6C1255,182,193Pink粉红#

    2022年8月6日
  • 谷粒商城笔记-基础篇-2(2/4)

    谷粒商城笔记-基础篇-2(2/4)1.整体介绍1)安装vagrant2)安装Centos7$vagrantinitcentos/7A`Vagrantfile`hasbeenplacedinthisdirectory.Youarenowreadyto`vagrantup`yourfirstvirtualenvironment!PleasereadthecommentsintheVagrantfileaswellasdocumentationon`vagrantup

    2022年6月5日
  • 计算机里libcurl.dll,Update.exe系统错误 由于找不到libcurl.dll,无法继续执行代码。重新安装程序可能会解决此问题。 – Microsoft Community…

    计算机里libcurl.dll,Update.exe系统错误 由于找不到libcurl.dll,无法继续执行代码。重新安装程序可能会解决此问题。 – Microsoft Community…您好,了解到您Windows10遇到系统错误的问题。请问您是在做什么操作遇到该问题的呢?您也可以尝试以下方法:1.从其他相同系统的计算机的C:\Windows\SysWOW64(64位win10)或C:\Windows\System32(32位win10)录路径中复制libcurl.dll动态链接库文件,也可以从百度下载对应版本系统的libcurl32.dll;2、得到该文件后,我们将其复制…

    2022年7月26日
  • Java三大版本「建议收藏」

    Java三大版本「建议收藏」Java三大版本​ Java三大版本代表着Java技术的三个应用领域:JavaSE、JavaME、JavaEE。​ Java以前很长一段时间被称为Java2,所以现在很多人习惯称为J2SE、J2ME、J2EE,它们表示的含义是一样的。JavaSE​ JavaSE,它是JAVA的标准版,是整个JAVA的基础和核心,也是JavaEE和JavaME技术的基础,主要用于开发桌面应用程序。JavaME​ JavaME,它叫做Java的微缩版,主要应用于嵌入式开发,比如手机程序的开发。JavaEE

    2022年7月8日
  • pytest失败重试_arcmap重分类失败

    pytest失败重试_arcmap重分类失败安装:pip3installpytest-rerunfailures重新运行所有失败用例要重新运行所有测试失败的用例,请使用–reruns命令行选项,并指定要运行测试的最大次数:$py

    2022年8月6日

发表回复

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

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