centos7打开php的curl,CentOS7 PHP cURL errno 35, 原因:CentOS7中没有安装curl和OpenSSL的最新版...

安装OpenSSL的最新版

话不多说,直接上安装步骤

#cd /usr/local/src

# 跳过证书获取失败

#wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz --no-check-certificate

# tar xzvf openssl-1.0.2n.tar.gz

# cd openssl-1.0.2n

# ./config shared enable-ssl2 enable-ssl3 --prefix=/usr

#makedepend

#make# #确认没有错误

#maketest

#make install# #如果顺利的话就好了

# openssl version

进展顺利

安装curl的最新版

这里也大体上就那样,不过,因为wget curl的文件的时候,SSL通信用其他的方法取得

# cd /usr/local/src

# #如果wget不能用其他的方法下载

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

# tar xzvf curl-7.58.0.tar.gz

# cd curl-7.58.0# ./configure --enable-libcurl-option --with-ssl=/usr --prefix=/usr

./confirure 的输出结果的一部分如下:

--如果弄错with-ssl的目录指定,SSL support的部分变成no。

--libcurl option:也确认一下是enabled吧。

configure: Configured to build curl/libcurl:

curl version:7.58.0Host setup: x86_64-pc-linux-gnu

Install prefix:/usr

Compiler:gccSSL support: enabled (OpenSSL)

SSH support: no (--with-libssh2)

zlib support: enabled

brotli support: no (--with-brotli)

GSS-API support: no (--with-gssapi)

TLS-SRP support: enabled

resolver: POSIX threaded

IPv6 support: enabled

Unix sockets support: enabled

IDN support: no (--with-{libidn2,winidn})

Build libcurl: Shared=yes, Static=yes

Built-inmanual: enabled--libcurl option: enabled (--disable-libcurl-option)

Verbose errors: enabled (--disable-verbose)

SSPI support: no (--enable-sspi)

ca cert bundle:/etc/pki/tls/certs/ca-bundle.crt

ca cert path: no

ca fallback: no

LDAP support: enabled (OpenLDAP)

LDAPS support: enabled

RTSP support: enabled

RTMP support: no (--with-librtmp)

metalink support: no (--with-libmetalink)

PSL support: no (libpsl not found)

HTTP2 support: disabled (--with-nghttp2)

Protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP

然后 make

# make

中途输出Warning: compression requested but Gzip is not available,这次没有通过!好像在hugehelp.c上输出了什么,应该不是严重的错误……?

然后 make install

# make install

下面显示输出结果的一部分。

/bin/sh ../libtool --mode=install /usr/bin/install -c libcurl.la '/usr/lib'libtool:install: /usr/bin/install -c .libs/libcurl.so.4.5.0 /usr/lib/libcurl.so.4.5.0(略)----------------------------------------------------------------------Libraries have been installedin:/usr/lib

If you ever happen to want to link against installed librariesina given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the'-LLIBDIR'flag during linking anddoat least one of the following:- add LIBDIR to the 'LD_LIBRARY_PATH'environment variable

during execution- add LIBDIR to the 'LD_RUN_PATH'environment variable

during linking- use the '-Wl,-rpath -Wl,LIBDIR'linker flag- have your system administrator add LIBDIR to '/etc/ld.so.conf'See any operating system documentation about shared librariesfor

more information, such as the ld(1) and ld.so(8) manual pages.----------------------------------------------------------------------

安装好了, curl -V 不过有错误。

curl: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory

好像无法读取库。

如果用ldd /usr/bin/curl确认的话,确实没有libcurl.so.4 =>的参照处。但是make install的时候/usr/lib/libcurl.so.4.5.0上写着安装了。

# # 在末尾添加“/usr/lib”# vim/etc/ld.so.conf.d/lib.conf

# ldconfig

这样就OK了。

curl -V

输出结果

curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.0.2n zlib/1.2.3Release-Date: 2018-01-24Protocols: dictfile ftpftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp

Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy

大功告成!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值