php 如何在 xampp 中启用 curl
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5418262/
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
how to enable curl in xampp
提问by Chauhan
I am facing this error given below
我正面临下面给出的这个错误
Fatal error: Call to undefined function curl_init() in E:\xampp\htdocs\new\functions.php on line 11
致命错误:在第 11 行调用 E:\xampp\htdocs\new\functions.php 中未定义的函数 curl_init()
I have already made change in php.ini
. I have removed the semicolon in front of
我已经在php.ini
. 我把前面的分号去掉了
;extension=php_crack.dll
extension=php_curl.dll
;extension=php_cvsclient.dll
and after that restart the xampp
but still facing same problem.Is there any other change need.Please let me know if any
I shall be very thankful to you all
之后重新启动xampp
但仍然面临同样的问题。是否有任何其他更改需要。请让我知道如果有的话,我将非常感谢你们
回答by Shakir
If you are using XAMPP, check these two locations:
如果您使用的是 XAMPP,请检查以下两个位置:
- C:\xampp\xampplite\apache\bin\php.ini
- C:\xampp\xampplite\php\php.ini
- C:\xampp\xampplite\apache\bin\php.ini
- C:\xampp\xampplite\php\php.ini
For the line ;extension=php_curl.dll
.
为行;extension=php_curl.dll
。
Remove the semicolon, save both files, restart your Apache and then run it again. I hope it will work.
删除分号,保存两个文件,重新启动 Apache,然后再次运行它。我希望它会起作用。
回答by Ashvintest Gargav
In Xampp i've found php.ini
at this location:
在 Xampp 中,我php.ini
在这个位置找到了:
C:\xampp\php\php.ini
I've removed ";" from ";extension=php_curl.dll" line. It works fine.
我已经删除了“;” 来自“;extension=php_curl.dll”行。它工作正常。
回答by Craig Sefton
Make sure you locate all the php.ini files in XAMPP. (Search your xampp folder for them). As far as I know, XAMPP has two or three, and it may be that you've enabled it in the incorrect file.
确保在 XAMPP 中找到所有 php.ini 文件。(在您的 xampp 文件夹中搜索它们)。据我所知,XAMPP 有两三个,可能是你在不正确的文件中启用了它。
回答by David Hobs
As you said, we'll uncomment the line ";extension=php_curl.dll" in php.ini
正如您所说,我们将取消注释 php.ini 中的“;extension=php_curl.dll”行
php.ini can be in multiple places. To check where the pertinent one is, go to phpmyadmin (http://localhost/phpmyadmin) run phpinfo() -> left hand side menu.
php.ini 可以在多个地方。要检查相关的位置,请转到 phpmyadmin (http://localhost/phpmyadmin) 运行 phpinfo() -> 左侧菜单。
It'll say a half page down in the left column: "Configuration File (php.ini) Path" with the path in the right column.
它会在左栏中显示半页:“配置文件(php.ini)路径”,右栏中的路径。
Or just search the page for php.ini (Ctrl+F)
或者只是在页面中搜索 php.ini (Ctrl+F)
Different versions of xampp had php.ini if in different directories, and some have 3 versions of the file in different places. Many tutorials say to change all of them in case you change settings/uses later.
不同版本的 xampp 有 php.ini 如果在不同的目录,有些在不同的地方有 3 个版本的文件。许多教程都说要更改所有这些,以防您以后更改设置/使用。
Open file in text editor and find the line (via search) ;extension=php_curl.dll
在文本编辑器中打开文件并找到该行(通过搜索);extension=php_curl.dll
Remove the ";" to uncomment it, so it becomes: extension=php_curl.dll
去除那个 ”;” 取消注释,所以它变成:extension=php_curl.dll
Save file. Restart apache.
保存存档。重启阿帕奇。
Double check and run phpinfo() again. Search for "curl" Under "cURL support" It should say "enabled."
再次检查并运行 phpinfo()。搜索“curl” 在“cURL support”下应该显示“enabled”。
Cheers!
干杯!
回答by MMT
Run the phpinfo();
from xampp and check out curl is enabled or not. or get script from here to check curl is enabled.
运行phpinfo();
from xampp 并检查 curl 是否启用。或从此处获取脚本以检查 curl 是否已启用。
http://www.webune.com/forums/how-to-check-curl-installed-in-php.html
http://www.webune.com/forums/how-to-check-curl-installed-in-php.html
回答by C0D3
Check this out: http://www.kanersan.com/blog.php?blogId=45I had a similar problem except for error reporting. Searched all over the internet and all I found was "modify the php.ini file". I modified all the php.ini files but I was still getting the same error. Turns out WAMP has visual settings which I believe overwrite the php.ini. So to turn on curl, you'd left click on XAMPP icon in your start start menu -> PHP -> PHP Settings -> php_curl (make sure it is checked).
看看这个:http: //www.kanersan.com/blog.php?blogId=45 除了错误报告之外,我遇到了类似的问题。在互联网上搜索,我发现的只是“修改 php.ini 文件”。我修改了所有 php.ini 文件,但仍然出现相同的错误。原来 WAMP 有视觉设置,我相信它会覆盖 php.ini。因此,要打开 curl,您需要在开始菜单中左键单击 XAMPP 图标 -> PHP -> PHP Settings -> php_curl(确保已选中)。
Maybe this is your problem.
也许这是你的问题。
Hope it helps.
希望能帮助到你。
-c0d3
-c0d3
回答by shyammakwana.me
if you have already uncommented line from php.ini and still getting error than you should make sure that this extension file is exists in php folder or not
如果您已经取消了 php.ini 中的注释行并且仍然出现错误,那么您应该确保该扩展文件是否存在于 php 文件夹中
so check for this file
所以检查这个文件
php_curl.dll
php_curl.dll
in xampp\php\exts
在 xampp\php\exts
if it's not there than download it from internet and paste it to there
如果它不存在,则从互联网上下载并粘贴到那里
Restart Apache.
重新启动阿帕奇。
回答by Harjinder singh
Steps:
脚步:
- Go to XAMPP folder: C:\xampp\php
- Find php.ini file
- Open it and remove semicolon before
php_curl.dll
, so, replace;extension=php_curl.dll
withextension=php_curl.dll
- Restart Apache before refreshing the page
- 转到 XAMPP 文件夹:C:\xampp\php
- 找到 php.ini 文件
- 打开它并删除之前的分号
php_curl.dll
,因此,替换;extension=php_curl.dll
为extension=php_curl.dll
- 刷新页面前重启Apache
回答by manuelbcd
Open php.ini and look for "extension_dir" parameter. Check that it is the correct and absolute path to your php extension dir.
打开 php.ini 并查找“extension_dir”参数。检查它是否是您的 php 扩展目录的正确绝对路径。
Example of a correct extension directory on windows xampp:
windows xampp 上正确扩展目录的示例:
extension_dir=c:\xampp\php\ext
If you are not sure what is happening try opening Apache error log and look for the text "php_curl" and "Unknown on line 0". This is the typical error message dispatched when Apache cannot load a module.
如果您不确定发生了什么,请尝试打开 Apache 错误日志并查找文本“php_curl”和“Unknown on line 0”。这是当 Apache 无法加载模块时调度的典型错误消息。