Detailed explanation of how to install PHP curl extension under Linux

Detailed explanation of how to install PHP curl extension under Linux

This article describes how to install the PHP curl extension under Linux. Share with you for your reference, the details are as follows:

I encountered such a problem during development today, which is how to install the curl extension of PHP under Linux. My LNMP environment was originally compiled and installed, not installed using YUM.

My environment:

Linux: CentOs 6.4
PHP: 5.6.30

Solution:

1. Enter the PHP source directory, which is the address where PHP was downloaded to the server and decompressed before.

cd /usr/local/src/php-5.6.30

2. Run ext/curl in the PHP source directory

cd ext/curl

3. Call the phpize program to generate a compiled configuration file

/usr/local/php/bin/phpize 

4. Call configure to generate Makefile

./configure --with-curl=/usr/local/curl --with-php-config=/usr/local/php/bin/php-config

5. Compile and install

make & make install

At this point, the path to generate the file curl.so will be prompted:

/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/

6. Modify the php.ini file

vim /usr/local/php/lib/php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl.so

7. Detection

/usr/local/php/bin/php -m

If you see the curl item, it means the installation is successful

8. Restart php-fpm

pkill -9 php-fpm
./sbin/php-fpm

OK!

I hope this article will help you configure your Linux server.

You may also be interested in:
  • Detailed tutorial on installing php-fpm service/extension/configuration in docker
  • Detailed explanation of installation and configuration of Redis and phpredis extension operation in Ubuntu 18.04 system
  • Detailed steps to install xml extension in php under linux
  • Solve the problem that PHP extension installation does not take effect
  • Detailed installation of PHP environment and extensions on Mac
  • Mac pecl installation php7.1 extension tutorial
  • How to install PHP7 Redis extension on CentOS7
  • How to install memcache extension in PHP
  • How to install BCMath extension in PHP
  • PHP extension installation method and steps analysis

<<:  Detailed explanation of the use of find_in_set() function in MySQL

>>:  VUE+Canvas realizes the whole process of a simple Gobang game

Recommend

Docker View the Mount Directory Operation of the Container

Only display Docker container mount directory inf...

Instructions for nested use of MySQL ifnull

Nested use of MySQL ifnull I searched online to s...

How to use HTML 5 drag and drop API in Vue

The Drag and Drop API adds draggable elements to ...

How to use TypeScript in Vue

introduction In recent years, the call for TypeSc...

A detailed introduction to the Linux directory structure

When you first start learning Linux, you first ne...

MySQL statement arrangement and summary introduction

SQL (Structured Query Language) statement, that i...

Node.js solves the problem of Chinese garbled characters in client request data

Node.js solves the problem of Chinese garbled cha...

...

Detailed explanation of the installation process of Jenkins on CentOS 7

Install Jenkins via Yum 1. Installation # yum sou...

How to restore single table data using MySQL full database backup data

Preface When backing up the database, a full data...

Example of Html shielding right-click menu and left-click typing function

Disable right-click menu <body oncontextmenu=s...

CSS flex several multi-column layout

Basic three-column layout .container{ display: fl...

Detailed explanation of the use of props in React's three major attributes

Table of contents Class Component Functional Comp...

N ways to achieve two-column layout with CSS

1. What is a two-column layout? There are two typ...