http.so已加载,但http_get未定义 [英] http.so loaded but http_get undefined

查看:270
本文介绍了http.so已加载,但http_get未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Linux发行版上安装了LAMP:

I have LAMP installed on my linux distribution:

///

PHP 5.4.9- 4ubuntu2.4(cli)(建于2013年12月12日04:29:20)
版权所有(c)1997-2012 PHP组
Zend Engine v2.4.0,版权所有(c)1998-2012 Zend技术
与Xdebug v2.2.1,版权所有(c)2002-2012,由Derick Rethans

PHP 5.4.9-4ubuntu2.4 (cli) (built: Dec 12 2013 04:29:20) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

///

为了使用pecl_http php扩展中的http_get,我已经明确安装了它并将http.so扩展名添加到了php.ini。

In order to use http_get from pecl_http php extension I have explicitly installed it and added the http.so extension to php.ini.

现在我在以下场景。使用下面的简单PHP代码:

Now I am in the following scenario. Using the simple php code below:

echo var_dump(extension_loaded("http"));

echo var_dump(extension_loaded("raphf"));

echo var_dump(extension_loaded("propro"));

echo var_dump(function_exists("http_get"));

$response = http_get("www.google.com");

echo $response;

我得到以下结果:

///

boolean true

boolean true

boolean true

**boolean false**

我不知道为什么extension_loaded( http)返回true,但function_exists(http_get)返回false,所以我不能使用函数http_get而不在Apache日志文件中获取以下内容

I am not sure why extension_loaded("http") returns true but function_exists("http_get") returns false, so I cannot use the function http_get without getting the following in the Apache log file

[Tue Dec 31 12:32:26 2013] [错误] [客户端127.0.0.1] PHP致命错误:在第32行的/home/user/main.php中调用未定义的函数http_get()

"[Tue Dec 31 12:32:26 2013] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function http_get() in /home/user/main.php on line 32"

你可以帮我解决这个问题吗?

Could you please help me troubleshooting this?

(使用控制台交互模式php -a的同样问题)

(same issue using the console interactive mode php -a)

phpinfo()显示:

phpinfo() shows:

///

http

HTTP支持已启用
扩展版本2.0.3

HTTP Support enabled Extension Version 2.0.3

已使用的库已编译链接
libz 1.2.7 1.2 .7
libcurl 7.29.0 7.29.0
l ibevent已禁用

Used Library Compiled Linked libz 1.2.7 1.2.7 libcurl 7.29.0 7.29.0 libevent disabled disabled

指令本地值主值
http.etag.mode crc32b crc32b

Directive Local Value Master Value http.etag.mode crc32b crc32b

/ //

谢谢

推荐答案

正如Michael Berkowski所说,2 .x分支是全新的,它可以使用不同的API。

As Michael Berkowski says, the 2.x branch is totally new and it works with a different API.

你可以使用1.x分支并以这种方式使用旧函数:

You can go with the 1.x branch and use the old functions this way:

pecl uninstal pecl_http
pecl install pecl_http-1.7.6

然后你可以使用http_get

Then you can use http_get

无论如何,如果这是一个全新的项目,建议你去最新的API。

Anyway, if this is a fresh new project, it is recommended to go with the newest API.

这篇关于http.so已加载,但http_get未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆