简体   繁体   English

如何在xampp中启用curl

[英]how to enable curl in xampp

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 . 我已经在php.ini进行了更改。 I have removed the semicolon in front of 我已经删除了前面的分号

;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但仍面临同样的问题。是否有任何其他更改需要。请让我知道,如果有任何我将非常感谢你们所有人

If you are using XAMPP, check these two locations: 如果您使用的是XAMPP,请检查以下两个位置:

  • C:\\xampp\\xampplite\\apache\\bin\\php.ini C:\\ XAMPP \\ Xampplite文件\\ apache的\\斌\\ php.ini中
  • C:\\xampp\\xampplite\\php\\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. 删除分号,保存两个文件,重新启动Apache,然后再次运行它。 I hope it will work. 我希望它能奏效。

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. 来自“; extension = php_curl.dll”行。 It works fine. 它工作正常。

Make sure you locate all the php.ini files in XAMPP. 确保在XAMPP中找到所有php.ini文件。 (Search your xampp folder for them). (在xampp文件夹中搜索它们)。 As far as I know, XAMPP has two or three, and it may be that you've enabled it in the incorrect file. 据我所知,XAMPP有两个或三个,可能是你在不正确的文件中启用它。

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. php.ini可以在多个地方。 To check where the pertinent one is, go to phpmyadmin (http://localhost/phpmyadmin) run phpinfo() -> left hand side menu. 要检查相关的位置,请转到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. 如果在不同的目录中,xampp的不同版本有php.ini,有些版本在不同的地方有3个版本的文件。 Many tutorials say to change all of them in case you change settings/uses later. 许多教程都说如果您稍后更改设置/使用,则更改所有这些内容。

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. 重启apache。

Double check and run phpinfo() again. 仔细检查并再次运行phpinfo()。 Search for "curl" Under "cURL support" It should say "enabled." 搜索“curl”在“cURL支持”下应该说“已启用”。

Cheers! 干杯!

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. 重启Apache。

Steps: 脚步:

  1. Go to XAMPP folder: C:\\xampp\\php 转到XAMPP文件夹:C:\\ xampp \\ php
  2. Find php.ini file 找到php.ini文件
  3. Open it and remove semicolon before php_curl.dll , so, replace ;extension=php_curl.dll with extension=php_curl.dll php_curl.dll之前打开它并删除分号,所以,替换;extension=php_curl.dll with extension=php_curl.dll
  4. Restart Apache before refreshing the page 刷新页面之前重新启动Apache

Open php.ini and look for "extension_dir" parameter. 打开php.ini并查找“extension_dir”参数。 Check that it is the correct and absolute path to your php extension dir. 检查它是你的php扩展dir的正确和绝对路径。

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". 如果您不确定发生了什么,请尝试打开Apache错误日志并查找文本“php_curl”和“第0行未知”。 This is the typical error message dispatched when Apache cannot load a module. 这是Apache无法加载模块时调度的典型错误消息。

Run the phpinfo(); 运行phpinfo(); from xampp and check out curl is enabled or not. 来自xampp并检查curl是否启用。 or get script from here to check curl is enabled. 或从此处获取脚本以检查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

Check this out: http://www.kanersan.com/blog.php?blogId=45 I had a similar problem except for error reporting. 看看这个: http//www.kanersan.com/blog.php?blogId = 45我有一个类似的问题,除了错误报告。 Searched all over the internet and all I found was "modify the php.ini file". 在互联网上搜索,我发现的只是“修改php.ini文件”。 I modified all the php.ini files but I was still getting the same error. 我修改了所有的php.ini文件,但我仍然得到了同样的错误。 Turns out WAMP has visual settings which I believe overwrite the php.ini. 原来WAMP有视觉设置我相信会覆盖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). 因此,要打开curl,您可以在开始菜单中单击XAMPP图标 - > PHP - > PHP设置 - > php_curl(确保已选中)。

Maybe this is your problem. 也许这是你的问题。

Hope it helps. 希望能帮助到你。

-c0d3 -c0d3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM