windows PHP 致命错误:找不到“HttpRequest”类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6980505/
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-09-15 17:44:38  来源:igfitidea点击:

PHP Fatal error: Class 'HttpRequest' not found

phpwindowshttprequestpecl

提问by Alexandre

I was wondering how I can't get rid of this error. I have a PHP 5.3 running on a Windows Server.

我想知道我如何无法摆脱这个错误。我有一个在 Windows 服务器上运行的 PHP 5.3。

In one of my file, I need to do a HttpRequest. The problem is that I need a specific *.dll (pecl_http.dll) that I can't find. Is there another way to do this, or has someone this *.dll for PHP 5.3 ?

在我的一个文件中,我需要做一个 HttpRequest。问题是我需要一个我找不到的特定 *.dll (pecl_http.dll)。有没有其他方法可以做到这一点,或者有人在 PHP 5.3 中使用 *.dll ?

Thanks for your help

谢谢你的帮助

Alexandre

亚历山大

回答by ChrisA

If you look down the list here: http://downloads.php.net/pierre/you'll see 4 versions of php_http. The 4 versions are all options of 'non-thread-safe' and 'thread-safe' (filename shows 'nts' or nothing), and VC6 or VC9.

如果您在此处查看列表:http: //downloads.php.net/pierre/,您将看到 php_http 的 4 个版本。这4个版本都是'non-thread-safe'和'thread-safe'(文件名显示'nts'或没有)选项,以及VC6或VC9。

To see if you need vc6 or vc9, load up phpinfo, and look at 'Compiler' near the top. A bit further down, you'll see 'Thread Safety' if this is enabled, go for the one that doesn't say 'nts'.

要查看您是否需要 vc6 或 vc9,请加载 phpinfo,然后查看顶部附近的“编译器”。再往下一点,如果启用了它,你会看到“线程安全”,选择不显示“nts”的那个。

回答by tony gil

install (or reinstall) the package

安装(或重新安装)软件包

$ pecl install -f pecl_http-1.7.6

or use curl - this is a working snippet

或使用 curl -这是一个工作片段