How to install php curl on ubuntu

藏色散人
Release: 2023-03-06 21:30:01
Original
1833 people have browsed it

How to install php curl on ubuntu: first download the curl installation package; then install cURL; and finally turn on the switch "–with-curl=/usr/local/curl".

How to install php curl on ubuntu

Recommendation: "PHP Video Tutorial"

php installation curl extension library under ubuntu

If PHP has been compiled in the system and new extensions need to be added later, one way is to completely recompile PHP, and the other way is to compile the extension library separately and extend it in the form of extension.

Situation 1: New installation of php and curl

First download the curl installation package (I downloaded curl-7.33.0.tar.gz, some versions have problems during compilation, this should Depends on the php version)

Then install cURL

# tar -zxf (此处填下载的curl包名称)
# ./configure –prefix=/usr/local/curl
# make; make install
Copy after login
Copy after login

When installing php, just turn on the switch –with-curl=/usr/local/curl.

PHP requires that the curl directory must have include and lib directories, and there must be two files easy.h and curl.h under include, and libcurl.a must be under lib. After compilation, the files in the include directory are there, but they may not be in the lib directory yet. It was originally generated in the lib/.libs directory, so it needs to be copied to the lib directory.

Situation 2: PHP has been installed, now you need to add this extension

cd $PHP_PATH/ext/curl (其中$PHP_PATH为php源码安装包目录)
phpize
 ./configure –with-curl=DIR   (可以不写dir,如果你的curl安装时没有指定目录)
make
Copy after login

The curl.so file will be generated under PHPDIR/ext/curl/moudles/.

Copy the curl.so file to the extensions configuration directory and just modify php.ini

# tar -zxf (此处填下载的curl包名称)
# ./configure –prefix=/usr/local/curl
# make; make install
Copy after login
Copy after login

The above is the detailed content of How to install php curl on ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template