PHP curl 修改配置為 SSL Version => OpenSSL
<?php
PHP curl 修改配置為 SSL Version => OpenSSL
===============================================
一:簡介
1:openssl 與 curl 擴充套件庫儘量不要覆蓋系統的 /usr/bin 目錄下的配置,會影響其他軟體的執行
2:先編譯php,不使用 --with-curl=DIR 配置,php編譯完成後再編譯 curl 模組。curl在php資源包ext目錄下。
因為編譯php時 --with-curl=DIR 指定目錄是無效的(存在這種情況)。--with-openssl=DIR 是有效的(也可能是無效的)
所以 -with-curl -with-openssl 在php編譯後,再編譯模組
二:openssl 下載與安裝
1:github 下載
~]# git clone https://github.com/openssl/openssl.git
2:編譯安裝
~]# ./config --prefix=/usr/local/software/openssl
# 備註:建議不使用 INSTALL 配置的 --openssldir=/usr/local/ssl
~]# make && make install
3:version
~]# /usr/local/software/openssl/bin/openssl version
OpenSSL 1.1.2-dev xx XXX xxxx
三:curl 下載與安裝
1:github 與 官網下載
官網: https://curl.haxx.se/download.html
github: https://github.com/curl/curl.git
2:編譯安裝
~]# ./configure --prefix=/usr/local/software/curl --with-ssl=/usr/local/software/openssl
# 備註:注意指定的是 openssl 的編譯時指定的目錄,而不是 bin/openssl 執行檔案
~]# make && make install
3:version
~]# /usr/local/software/curl/bin/curl --version
curl 7.61.1 (x86_64-apple-darwin17.7.0) libcurl/7.61.1 OpenSSL/1.0.2p zlib/1.2.11 libidn2/2.0.5
Release-Date: 2018-09-05
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy
四:php curl 擴充套件安裝
1:擴充套件目錄在 php 資源包中 ext 目錄下
2:模組編譯安裝
~]# /usr/local/software/php71/bin/phpize
~]# ./configure --with-php-config=/usr/local/software/php71/bin/php-config --with-curl=/usr/local/software/curl/
# 備註 --with-curl=DIR 使用curl編譯的的目錄而不是 bin/curl 執行檔案
~]# /usr/local/software/php71/bin/php
php.ini 設定 extension=curl.so
3:version
~]# php -i
SSL Version => OpenSSL/1.0.2p
ZLib Version => 1.2.11