參考:https://www.latoooo.com/xia_zhe_teng/368.htm
我的系統版本是 Centos 7 64位。
為了方便,先安裝常用的開發環境。
yum groupinstall Development tools
1.下載 OpenSSL:
wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
2.解壓 OpenSSL:
tar -xzvf openssl-1.0.2l.tar.gz
3.進入 OpenSSL目錄:
cd openssl-1.0.2l
4.配置並編譯 OpenSSL:
./config --shared make && make install
5.下載 curl 庫:
wget https://curl.haxx.se/download/curl-7.55.1.tar.gz
6.解壓 curl 庫:
tar -xzvf curl-7.55.1.tar.gz
7.進入 curl 目錄:
cd curl-7.55.1
8.設置動態庫路徑:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ssl/lib
9.配置並編譯 curl:
./configure --prefix=/usr/local/curl/ --without-nss --with-ssl=/usr/local/ssl/ make && make install
10.備份默認的 curl 二進制文件
mv /usr/bin/curl /usr/bin/curl.bak
11.做一個新的 curl 軟鏈
ln -s /usr/local/curl/bin/curl /usr/bin/curl
總體的替換到此就完成,可以執行 curl --version
來進行確認。下邊是我執行的結果:
curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1 OpenSSL/1.0.2l Release-Date: 2017-08-14 Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL TLS-SRP UnixSockets HTTPS-proxy
如果你在linux服務器經常需要安裝新的php應用,那難免會遇到需要重新編譯php,給它增加新的功能的情況。重新編譯php后,一方面需要替換掉原來的php,另一方面需要保障其他在線網站的正常運轉,就需要對php進行平滑替換了。這個過程該如何進行呢?給出一點我在這方面積累的經驗。
找出原來php的配置參數
~:php -i|grep configure
./configure '--prefix=/usr/local/php' '--with-freetype-dir=/usr/local/freetype' '--with-gd' '--with-gettext' '--with-iconv-dir' '--with-mysqli' '--with-openssl' '--with-pcre-regex' '--with-pdo-mysql' '--with-pdo-sqlite' '--with-pear' '--with-png-dir=/usr/local/libpng' '--with-jpeg-dir=/usr/local/libjpeg' '--with-xsl' '--with-zlib' '--enable-fpm' '--enable-bcmath' '--enable-libxml' '--enable-inline-optimization' '--enable-gd-native-ttf' '--enable-mbregex' '--enable-mbstring' '--enable-opcache' '--enable-pcntl' '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sysvsem' '--enable-xml' '--enable-zip' '--with-curl=/usr/local/curl'
重啟php-fpm /usr/local/php/sbin/php-fpm