Home >Backend Development >PHP Problem >About php installation curl extension

About php installation curl extension

藏色散人
藏色散人Original
2020-11-04 09:30:221882browse

How to install curl extension in php: first download the source code package and decompress it; then precompile and specify the installation location; then install the extension through "make && make install"; finally modify php.ini and restart php-fpm That’s it.

About php installation curl extension

Recommended: "PHP Video Tutorial"

The steps are as follows:

(1、下载并安装 curl)
#下载源码包
(源码包列表)
https://curl.haxx.se/download/  或  https://curl.haxx.se/download.html
(或者直接下载7.55.1版本的curl包)
wget https://curl.haxx.se/download/curl-7.55.1.tar.gz
#解压
tar -zxvf curl-7.55.1.tar.gz
#进入目录
cd curl-7.55.1
#预编译(并指定安装位置)
mkdir /usr/local/lib/curl
./configure --prefix=/usr/local/lib/curl/
#安装
make && make install
 
 
(2、生成 curl 扩展)
#进入 php 源码包安装位置
cd /data/soft/php/ext/curl
#生成 configure 文件
/usr/local/php/bin/phpize
#预编译
./configure --with-php-config=/usr/local/php/bin/php-config  --with-curl=/usr/local/lib/curl
#安装
make && make install
 
 
(3、修改 php.ini)
extension_dir="/usr/local/php/lib/php/extensions/no-debug-zts-20121212/"
extension=curl.so
 
(4、重启php-fpm)
/usr/local/nginx/sbin/nginx -s stop       #先暂停一下 nginx
pkill php-fpm                             #杀死 php-fpm
/usr/local/php/sbin/php-fpm               #开启 php-fpm
/usr/local/nginx/sbin/nginx               #开启 nginx

The above is the detailed content of About php installation curl extension. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn