centos系统中php Curl 无法访问https 的解决办法

在centos 6上面,curl模块的ssl 支持默认为NSS,涉及到的程序里有https,是需要双向认证的,这时使用NSS会报错,所以需要更换为openssl。

  1. 查看系统自带的curl版本
[root@localhost local]# curl -V
curl 7.19.7
  1. 得到curl当前版本是7.19.7,去官方下载http://curl.haxx.se/download/archeology/ 同样版本,然后解压、编译。
wget http://curl.haxx.se/download/archeology/curl-7.19.7.tar.gz
tar -zxf curl-7.19.7.tar.gz
cd curl-7.19.7
./configure --without-nss --with-ssl
make && make install

–without-nss 禁用nss, –with-ssl启用openssl的支持.

  1. 将curl的库载入动态共享文件,并重新加载
echo "/usr/local/lib" >> /etc/ld.so.conf 
ldconfig
  1. 查看新安装后curl的版本
[root@localhost local]# curl -V
curl 7.19.7 (x86_64-unknown-linux-gnu) libcurl/7.19.7 OpenSSL/1.0.1e zlib/1.2.3 libidn/1.18
Protocols: tftp ftp telnet dict http file https ftps 
Features: IDN IPv6 Largefile NTLM SSL libz 
  1. 重启你的httpd/nginx服务和php服务器
service nginx restart #或service httpd restart
service php-fpm restart



作者:千学阁
链接:https://www.jianshu.com/p/0b68ae41d7d2
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装DVWA需要以下步骤: 1. 首先,下载CentOS 7 Minimal版本,并安装VMware Workstation虚拟机软件。 2. 在VMware Workstation新建虚拟机,选择典型模式,然后选择下载的CentOS 7镜像文件。 3. 根据设备的配置设置处理器、内存等相关信息,然后开启虚拟机。 4. 进入图形化安装CentOS界面,按照提示一步步完成安装,然后重启进入系统。 5. 配置CentOS 7的yum国内镜像源,可以使用以下命令: ``` curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum clean all yum makecache ``` 6. 安装LAMP环境,包括Apache、PHP和MySQL。可以使用以下命令安装: ``` yum install httpd yum install php php-mysql yum install mysql-server ``` 7. 启动Apache和MySQL服务,并设置为开机启动: ``` systemctl start httpd systemctl start mysqld systemctl enable httpd systemctl enable mysqld ``` 8. 下载DVWA,并解压文件到Apache的默认网站目录(通常是/var/www/html/): ``` wget https://github.com/ethicalhack3r/DVWA/archive/master.zip unzip master.zip mv DVWA-master /var/www/html/dvwa ``` 9. 配置DVWA文件,包括MySQL数据库配置和reCAPTCHA配置。可以通过编辑/var/www/html/dvwa/config/config.inc.php文件进行配置。 10. 修改php.ini文件,确保以下设置正确: ``` allow_url_include = On allow_url_fopen = On magic_quotes_gpc = Off session.auto_start = 0 ``` 11. 最后,通过浏览器访问http://localhost/dvwa来访问DVWA靶场。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值