Home >Backend Development >PHP Tutorial >Detailed explanation of how to enable curl extension in PHP

Detailed explanation of how to enable curl extension in PHP

WBOY
WBOYOriginal
2016-07-25 08:52:191414browse
  1. # tar -zxf (fill in the downloaded curl package name here)
  2. # ./configure –prefix=/usr/local/curl
  3. # make; make install
Copy the code

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 Enter the source code directory where the original PHP was installed (if it was deleted but the original compressed file is still there, just decompress it again)

  1. cd ext/curl
  2. phpize ./configure –with-curl=DIR (you don’t need to write dir, if your curl installation does not specify the directory)
  3. make
Copy the code

and it will be in The curl.so file is generated under PHPDIR/ext/curl/moudles/. Copy the curl.so file to the extensions configuration directory and modify php.ini.

The installation method of php extension cURL under Linux has been introduced. I hope it will be helpful to everyone.

The article is a bit old, but the stuff is really good, haha. Let’s study carefully curl extension in php programming. This is quite useful when writing some network programs.



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