Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fatal error: Class 'HttpRequest' not found

3,369 views
Skip to first unread message

Francisco

unread,
Aug 7, 2012, 1:08:03 PM8/7/12
to
Hello all,


I want to use extension php_http.dll but i cant succeed to do it.
First i used easyPHP version 12, then i tried to install PHP and
Appache as separate modules.

I still get the same error

Fatal error: Class 'HttpRequest' not found in
C:\Apache2\htdocs\testPHP\authenticate2.php on line 26

Its like as if php_http extention does not work on my conf, i get this
error when i use class HttpRequest.

I use the followin PHP code:

<?php
$application = '/titi/api/login';

// get input parameters
$login = $_POST['login'];
$password = $_POST['password'];
$server = $_POST['server'];
$port = $_POST['port'];

// store this in a cookie like this(for now)
$_SESSION['login'] = $login;
$_SESSION['password'] = $password;
$_SESSION['server'] = $server;
$_SESSION['port'] = $port;

$credentials = $login.':'.$password;

$options = array(
'httpauth' => base64_encode
($credentials),
'httpauthtype' => HTTP_AUTH_BASIC, // auth
basic type
'protocol' => HTTP_VERSION_1_1
);

$url = 'http://'. $server. ':' . $port . $application;
//echo $url;
$request = new HttpRequest($url,HttpRequest::METH_POST );
$request->setContentType('Content-Type: text/xml');
$request->setOptions($options);
$result = $httpRequest->send();

//print out the result
echo "<pre>"; print_r($result); echo "</pre>";
echo $resp;

?>

About my conf :

---------------APACHE-------------------------------------
I installed Apache 2.2.22 from http://www.apachelounge.com/ to get
windows binaries
I used
http://www.apachelounge.com/download/win32/binaries/httpd-2.2.22-win32-VC9.zip
I also installed necessary windows binaries, that are referenced by
apache : http://www.microsoft.com/download/en/details.aspx?id=5582

--------------PHP-----------------------------------------
I installed php from : http://windows.php.net/download/
I used the following version:
http://windows.php.net/downloads/releases/php-5.3.15-Win32-VC9-x86.msi

The php_http.dll extension was fecthed at
http://downloads.php.net/pierre/
I used the following version :
http://downloads.php.net/pierre/php_http-5.3-svn20091125-vc9-x86.zip
I droped this extension in the following directory [PHP_INSTALL]\ext
----------conf APache et
PHP-------------------------------------------------
I modified apache conf file httpd.conf to add in it :

PHPIniDir "C:\Program Files (x86)\PHP\"
LoadModule php5_module "C:\Program Files (x86)\PHP\php5apache2_2.dll"
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>


I payed a ot of attention to windows binary compatibility (VC9, x86,
win32) for compilation options used for each components.

It seems to work so far because when i used command line "php -m" i get
:

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
filter
ftp
gd
gettext
gmp
hash
http
iconv
imap
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
pgsql
Phar
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
zip
zlib

and when i use command line "php --ri http" I get :

http

HTTP Support => enabled
Extension Version => 1.7.0-dev
Registered Classes => HttpUtil, HttpMessage, HttpRequest,
HttpRequestPool, HttpRequestDataShare, HttpDeflateStream,
HttpInflateStream, HttpResponse, HttpQueryString
Output Handlers => ob_deflatehandler, ob_inflatehandler, ob_etaghandler
Stream Filters => http.chunked_decode, http.chunked_encode,
http.deflate, http.inflate

Used Library => Compiled => Linked
libcurl => 7.19.6 => 7.19.6
libevent => disabled => disabled
libz => 1.2.3 => 1.2.3
libmagic => disabled => disabled

Persistent Handles
Provider => Ident => Used => Free
http_request => N/A => 0 => 0
http_request_datashare => GLOBAL => 1 => 0
http_request_datashare_lock => GLOBAL => 1 => 0
http_request_pool => N/A => 0 => 0

Request Methods
Registered => GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE, CONNECT,
PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, VERSION-CONTROL,
REPORT, CHECKOUT, CHECKIN, UNCHECKOUT, MKWORKSPACE, UPDATE,
LABEL, MERGE, BASELINE-CONTROL, MKACTIVITY, ACL,
Allowed => (ANY)

Directive => Local Value => Master Value
http.etag.mode => MD5 => MD5
http.log.cache => no value => no value
http.log.redirect => no value => no value
http.log.not_found => no value => no value
http.log.allowed_methods => no value => no value
http.log.composite => no value => no value
http.request.methods.allowed => no value => no value
http.request.methods.custom => no value => no value
http.request.datashare.cookie => 0 => 0
http.request.datashare.dns => 1 => 1
http.request.datashare.ssl => 0 => 0
http.request.datashare.connect => 0 => 0
http.send.inflate.start_auto => 0 => 0
http.send.inflate.start_flags => 0 => 0
http.send.deflate.start_auto => 0 => 0
http.send.deflate.start_flags => 0 => 0
http.persistent.handles.limit => -1 => -1
http.persistent.handles.ident => GLOBAL => GLOBAL
http.send.not_found_404 => 1 => 1

I am out of ideas, I am a PHP beginner.
Does someone has any ideas about what i am doing wrong here?
Any new ideas about what to check ?
Thanks for your help !


Francisco

unread,
Aug 7, 2012, 1:09:42 PM8/7/12
to
Francisco has brought this to us :
Oh I forgot to say i added the extension php_http.dll in php.ini file.


J.O. Aho

unread,
Aug 7, 2012, 1:28:07 PM8/7/12
to
On 07/08/12 19:09, Francisco wrote:

>> Fatal error: Class 'HttpRequest' not found in
>> C:\Apache2\htdocs\testPHP\authenticate2.php on line 26
>>
>> Its like as if php_http extention does not work on my conf, i get this
>> error when i use class HttpRequest.

You need to install pecl_http 0.10.0 or later, please read the following
pages:

http://www.php.net/manual/en/http.setup.php

--

//Aho

Joshua Richet

unread,
Feb 9, 2022, 5:08:08 PM2/9/22
to
Dead link. Any other suggestions how to solve this?

J.O. Aho

unread,
Feb 10, 2022, 2:07:20 AM2/10/22
to

On 09/02/2022 23.07, Joshua Richet wrote:
> On Tuesday, August 7, 2012 at 10:28:07 AM UTC-7, J.O. Aho wrote:
>> On 07/08/12 19:09, Francisco wrote:
>>
>>>> Fatal error: Class 'HttpRequest' not found in
>>>> C:\Apache2\htdocs\testPHP\authenticate2.php on line 26
>>>>
>>>> Its like as if php_http extention does not work on my conf, i get this
>>>> error when i use class HttpRequest.
>> You need to install pecl_http 0.10.0 or later, please read the following
>> pages:
>>
>> http://www.php.net/manual/en/http.setup.php
>
> Dead link. Any other suggestions how to solve this?

Yes, the older post you find the more likely links are dead, think
php.net rewamped their whole site 6 years ago. Maybe the page was
indirectly telling about how to install pecl extensions.

https://www.php.net/manual/en/install.pecl.php

The pecl in question is still the old pecl_http, seems to have had some
updates 3 months ago, so it's still somewhat maintained.



A side note: remove footers manually as you are using google and
google's web based usergroup client do not understand how to remove
footers automatically.

--

//Aho
0 new messages