php安装curl扩展

一、linux中php如何安装curl扩展

要 PHP 支持 cURL,必须在编译 PHP 时加上 --with-curl[=DIR] 选项,DIR 为包含 lib 和 include 的目录路径。在 include 目录中必须有一个名为 curl,包含了 easy.h 和 curl.h 的文件夹。lib 文件夹里应该有一个名为 libcurl.a 的文件。对于 PHP 5.5.0 之前版本,你可以配置 --with-curlwrappers 使 cURL 使用 URL 流。

二、window下安装php_curl支持:

1、编辑php.ini配置文件,开启extension=php_curl.dll选项

在php.ini中去掉 ;extension=php_curl.dll前的分号;即可

image.png

2、将php文件夹下的libeay32.dll,ssleay32.dll,libssh2.dll 文件移入windows/system32文件夹下;

注意:

OpenSSL 1.1 环境下则为 libcrypto-*.dll 和 libssl-*.dll 文件。同样的,libssh2.dll 文件也需要放到 PATH 环境变量包含的目录下。 不需要用 cURL 网站上的 libcurl.dll 库。

image.png

3、重启 Apache即可。

image.png