php 如何在 xampp 中启用 curl?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3020049/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 08:26:52  来源:igfitidea点击:

How to enable curl in xampp?

phpcurlxampp

提问by Aakash Chakravarthy

How to enable curl in xampp ?

如何在 xampp 中启用 curl ?

My PHP twitter application needs curl function. But it is not enabled in XAMPP. how to enable it. I found no options for doing that.

我的 PHP twitter 应用程序需要 curl 功能。但它在 XAMPP 中没有启用。如何启用它。我没有找到这样做的选择。

回答by Anjuman

You have to modify the php.ini files in your xampp folder. Three files in three different places need to be changed.

您必须修改 xampp 文件夹中的 php.ini 文件。三个不同地方的三个文件需要更改。

Follow the following steps to enable curl library with XAMPP in Windows:

按照以下步骤在 Windows 中使用 XAMPP 启用 curl 库:

Step 1:

第1步:

Browse and open the following 3 files

浏览并打开以下 3 个文件

C:\Program Files\xampp\apache\bin\php.ini
C:\Program Files\xampp\php\php.ini
C:\Program Files\xampp\php\php4\php.ini

Step 2:

第2步:

Uncomment the following line in your php.ini file by removing the semicolon (;).

通过删除分号 (;) 在 php.ini 文件中取消注释以下行。

;extension=php_curl.dll

After that it will look something like something below-

之后它会看起来像下面的东西-

extension=php_curl.dll

Step 3:

第 3 步:

Restart your Apache server.

重新启动您的 Apache 服务器。

Step 4:

第四步:

Check your phpinfo()to see whether curl has properly enabled or not.

检查您的phpinfo()curl 是否已正确启用。

Enjoy using curl() library.

享受使用 curl() 库。

回答by Sarfraz

It should be available in php.ini file. You need to un-comment the line for curl extension:

它应该在 php.ini 文件中可用。您需要取消注释 curl 扩展名:

  ;extension=php_curl.dll
  ^----- remove semi-colon

回答by mohitsoni

In XAMPP installation directory, open %XAMPP_HOME%/php/php.inifile. Uncomment the following line: extension=php_curl.dll

在 XAMPP 安装目录中,打开%XAMPP_HOME%/php/php.ini文件。取消注释以下行: extension=php_curl.dll

PS: If that doesn't work then check whether %XAMPP_HOME%/php/ext/php_curl.dllfile exist or not.

PS:如果这不起作用,请检查%XAMPP_HOME%/php/ext/php_curl.dll文件是否存在。

回答by webvitaly

1) C:\Program Files\xampp\php\php.ini

1) C:\Program Files\xampp\php\php.ini

2) Uncomment the following line on your php.ini file by removing the semicolon.

2) 通过删除分号取消对 php.ini 文件中的以下行的注释。

;extension=php_curl.dll

;扩展= p​​hp_curl.dll

3) Restart your apache server.

3)重启你的apache服务器。

回答by Vinicius Martinson

You can add any extension (in Wamp and Xampp servers) by removing the semi-colon (;)

您可以通过删除分号 (;) 来添加任何扩展(在 Wamp 和 Xampp 服务器中)

回答by Simon

First, make sure you have libcurl(see: http://curl.haxx.se) installed. Then make sure your copy of PHP has been compiled with the --with-curl[=DIR]flag. For more info see:

首先,确保您已安装libcurl(请参阅:http: //curl.haxx.se)。然后确保您的 PHP 副本已使用该--with-curl[=DIR]标志编译。有关更多信息,请参阅:

If XAMPP comes pre-compiled with cURL you may just need to enable the extension in your php.ini file (usually by removing a semicolon at the start of the line which includes the extension).

如果 XAMPP 是使用 cURL 预编译的,您可能只需要在 php.ini 文件中启用扩展(通常通过删除包含扩展的行开头的分号)。

回答by Esteban Cacavelos

For XAMPP on MACOS or Linux, remove the semicolon in php.ini file after extension=curl.so

对于 MACOS 或 Linux 上的 XAMPP,删除 php.ini 文件中extension=curl.so后的分号