Home >Backend Development >PHP Problem >How to install curl extension in php
How to install curl extension in php: 1. Download the curl source package and place it in the source package directory; 2. Compile and install the curl extension; 3. Edit the php.ini configuration file and enable curl support; 4. Restart apache Serve.
The installation steps are as follows:
(Video tutorial recommendation: php video tutorial)
First To install the curl service, first download the curl source package and put it in the source package directory
#下载源码包 (源码包列表) 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
Install the curl extension of php, remember to precompile --with-curl = /usr/local/lib/curl is to install curl above directory
#进入 php 扩展包安装位置 cd /usr/local/src/php-7.0.12/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
After installation, you will be prompted to generate the curl.so file
# in /usr/local/php/lib/php/extensions/no-debug-zts-20151012/
##Edit the php.ini configuration file, enable curl supportextension_dir="/usr/local/php/lib/php/extensions/no-debug-zts-20151012/ " extension=curl.so 开启或者加上Finally restart apache. Related recommendations:
The above is the detailed content of How to install curl extension in php. For more information, please follow other related articles on the PHP Chinese website!