64位Win7手动安装配置的php7.3.11下curl出错解决办法(wamp Call to undefined function curl_init )

2021-01-25 17:52:41

64位Win7手动安装配置的php7.3.11下curl出现“Call to undefined function curl_init ...”错误提示的解决办法

在64位Win7系统下,手动安装的php7.3.11运行下面的代码时出现“Fatal error: Uncaught Error: Call to undefined function curl_init() in ...”错误提示: $url = "https://www.baidu.com/";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$str = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'ERROR ' . curl_error($ch);
}
curl_close($ch);
echo $str;
?>

在网上找了很多资料,尝试了各种办法,最后问题得以解决,具体操作如下:

1. 在php安装目录下(我的是D:webServphp7.3),用文本编辑器修改php.ini文件:去掉extension=curl前面的“;”;

2. 在Apache的安装目录下找到conf文件夹(我的是D:webServApache24conf),文本编辑器打开httpd.conf文件,在文件最后一行追加下面2行代码:

LoadFile D:/webServ/php7.3/php7ts.dll
LoadFile D:/webServ/php7.3/libssh2.dll

3. 以管理员身份运行cmd,在命令行窗口进入到Apache的bin目录下,输入“httpd - k restart”命令回车重启Apache服务;

再运行上面的代码,出现百度搜索界面,问题解决!
以上内容是参考,摘自http://blog.elight.cn/?post=411

我用的是WAMP的,PHP版本是7.3.12,APACHE2.4.41处理方式如下:
1. 打开APACHE的httpd.conf配置文件
2. 搜索 php7,找到 LoadModule php7_module "${INSTALL_DIR}/bin/php/php7.3.12/php7apache2_4.dll"这行
3. 在后面追加两行内容:
LoadModule php7_module "${INSTALL_DIR}/bin/php/php7.3.12/php7ts.dll"
LoadModule php7_module "${INSTALL_DIR}/bin/php/php7.3.12/libssh2.dll"
重新WAMP后,搞定

发表评论:

  • Nickname_247 :Choosing the best deplorable defence attorney in United Arab Republic is determining for ensuring a clean tribulation and a lucky result

  • Nickname_1159 :Hi there colleagues its impressive piece of writing regarding teachingand fully explained keep it up all the time

  • Nickname_4366 :Wow marvelous weblog structure How lengthy have you been blogging for you make blogging glance easy The whole glance of your web site is fantastic let alone the content material

  • Nickname_4772 :Ahaa its nice dialogue on the topic of this post here at this blog I have read all that so now me also commenting at this place

  • Nickname_5988 :Very nice post I just stumbled upon your blog and wished to say that Ive truly enjoyed surfing around your blog posts After all Ill be subscribing to your feed and I hope you write again very soon

  • Nickname_6298 :bookmarked I love your site

  • Nickname_6599 :Its very effortless to find out any matter on web as compared to textbooks as I found this article at this web site

  • Nickname_6907 :I have been browsing online more than three hours lately yet I never discovered any fascinating article like yours Its lovely worth sufficient for me Personally if all site owners and bloggers made good content as you probably did the internet will probably be a lot more helpful than ever before

  • Nickname_9629 :Thanks for sharing such a pleasant thought post is nice thats why i have read it fully

  • Nickname_9852 :I know this if off topic but Im looking into starting my own blog and was curious what all is needed to get set up Im assuming having a blog like yours would cost a pretty penny Im not very web smart so Im not 100 certain Any tips or advice would be greatly appreciated Cheers

  • Nickname_10203 :I dont even understand how I stopped up here but I believed this submit was once good I dont recognize who you might be but certainly youre going to a wellknown blogger when you are not already Cheers

Powered by PHP 学习者(mail:517730729@qq.com)

原百度博客:http://hi.baidu.com/ssfnadn

备案号:闽ICP备17000564号-1

开源中国 PHPCHINA