Linux system PHP Installation Curl Extension support HTTPS tutorial detailed

Source: Internet
Author: User
Tags curl gettext soap mcrypt openssl pear phpinfo

Problem:

On-line lamp server, the default Yum installed Curl module only supports HTTP and does not support HTTPS.

Workaround:

Compile and install curl, recompile PHP, and enable PHP's Curl module to support HTTPS.

Specific steps:

1, Download Curl

CD/USR/LOCAL/SRC #进入安装包存放目录

wget http://curl.haxx.se/download/curl-7.44.0.tar.gz #下载

2. Installation 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, recompile PHP

Find the PHP compilation parameters before the system

/usr/local/php/bin/php-i | grep Configure #查看php编译参数

As follows:

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

To modify a parameter:

As follows

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

Remarks: Modify part


Cancel the original--with-curl

To be replaced by:--with-curl=/usr/local/curl

Remove single quotes on both sides of a parameter

Other unchanged

cd/usr/local/src/php #进入php安装包目录 (Note that PHP version should be the same as before)

./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-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, restart Apache to make the settings effective

Service httpd Restart #重启

Fault Resolution!

5, testing

The following code, save as Phpinfo.php

<?php

Phpinfo ();

?>

Upload to the Site directory, find Curl, as shown in the following figure, the installation is successful!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.