Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6733 > unrolled thread

Fatal error: Class 'HttpRequest' not found

Started byFrancisco <francisco@nospam.fr>
First post2012-08-07 19:08 +0200
Last post2012-08-07 19:28 +0200
Articles 3 — 2 participants

Back to article view | Back to comp.lang.php


Contents

  Fatal error: Class 'HttpRequest' not found Francisco <francisco@nospam.fr> - 2012-08-07 19:08 +0200
    Re: Fatal error: Class 'HttpRequest' not found Francisco <francisco@nospam.fr> - 2012-08-07 19:09 +0200
      Re: Fatal error: Class 'HttpRequest' not found "J.O. Aho" <user@example.net> - 2012-08-07 19:28 +0200

#6733 — Fatal error: Class 'HttpRequest' not found

FromFrancisco <francisco@nospam.fr>
Date2012-08-07 19:08 +0200
SubjectFatal error: Class 'HttpRequest' not found
Message-ID<50214b74$0$1700$426a74cc@news.free.fr>
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 !

[toc] | [next] | [standalone]


#6734

FromFrancisco <francisco@nospam.fr>
Date2012-08-07 19:09 +0200
Message-ID<50214bd6$0$30640$426a74cc@news.free.fr>
In reply to#6733
Francisco has brought this to us :
> 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 !

Oh I forgot to say i added the extension php_http.dll in php.ini file.

[toc] | [prev] | [next] | [standalone]


#6735

From"J.O. Aho" <user@example.net>
Date2012-08-07 19:28 +0200
Message-ID<a8d1h7Faj7U1@mid.individual.net>
In reply to#6734
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web