Unable to add extension php_http.dll

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Unable to add extension php_http.dll

Postby Alex R4 » 25. December 2014 10:13

Merry Christmas!

I am trying to add the extension php_http.dll to the core php system.
The php system is part of the XAMPP localhost testing environment.

operating system: Windows 7
xampp version: 1.8.2
php version: 5.4.19

I downloaded the http extension from here:
http://windows.php.net/downloads/pecl/releases/http/
There are so many releases to choose from, so I downloaded the one which came closest to the release date of the php system.
I extracted the files in the download directory and copied the php_http.dll file into the correct ext directory.
I modified the php.ini file to recognise the new extension.

;extension=php_sybase_ct.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll

; added 23.12.2014 Alex
extension=php_http.dll

Two error messages at startup of apache server from the XAMPP Control Panel:

httpd.exe - System Error
The program can't start because php5.dll is missing from your computer.
Try reinstalling the program to fix this problem.

and

Warning
PHP Startup: Unable to load dynamic library
'I:\Project\src\php\ext\php_http.dll' - The specific procedure could not be found.

As soon as I comment out the line in php.ini the errors disappear.

So, where am I going wrong?
Any help would be appreciated.
Alex R4
 
Posts: 31
Joined: 08. April 2014 11:24
Location: Adelaide/Australia
Operating System: Windows 7

Re: Unable to add extension php_http.dll

Postby gsmith » 25. December 2014 19:01

I don't understand this one, the php5.dll

I do know that to get 2.1.4 version of the extension working on my PHP 5.4.36 I also needed the required
php_propro.dll & php_raphf.dll
http://windows.php.net/downloads/pecl/snaps/

They needed to be loaded in this order
extension=php_propro.dll
extension=php_raphf.dll
extension=php_http.dll

Complete list of dependencies are listed at the bottom of the page for the http pecl extension.

If worse comes to worse and that doesn't clear it up, you could put the php location in the system path but this really shouldn't be needed.

Good luck and Merry Christmas
gsmith
 
Posts: 194
Joined: 29. November 2013 18:04
Location: San Diego
XAMPP version: 0.0.0
Operating System: Win XP to 2012R2/VS 6,9,11,14

Re: Unable to add extension php_http.dll

Postby Alex R4 » 26. December 2014 05:46

gsmith wrote:They needed to be loaded in this order
extension=php_propro.dll
extension=php_raphf.dll
extension=php_http.dll


Excellent! Did that, started XAMPP, no errors!

I can only assume that php has loaded these dlls correctly. When I started my test.php, which calls

$message = new HttpMessage("testMessage");

I get a fatal error, because php can not resolve the "HttpMessage" reference. I assumed the php_http.dll would contain these classes HttpRequest/HttpResponse/HttpMessage etc.
Do I have to declare a reference to these classes in my code?

Thanks for your post, one step closer but not quite there yet.
Alex R4
 
Posts: 31
Joined: 08. April 2014 11:24
Location: Adelaide/Australia
Operating System: Windows 7

Re: Unable to add extension php_http.dll

Postby Nobbie » 26. December 2014 12:17

Alex R4 wrote:I can only assume that php has loaded these dlls correctly.


Run a phpinfo() which shows up all loaded extensions and also check your error_log for any clues. According to a similar question in the german board (see viewtopic.php?f=4&t=70009), your Windows may need a copy of MSVCR71.dll (put it in the system32 folder after download).
Nobbie
 
Posts: 8762
Joined: 09. March 2008 13:04

Re: Unable to add extension php_http.dll

Postby Alex R4 » 27. December 2014 07:53

Nobbie wrote:Run a phpinfo() which shows up all loaded extensions and also check your error_log for any clues.


Good one. Thank you.
Now I know what the problem is, but I don't know how to solve it.

I had a good look at phpinfo() and found that the php header files belonging to php_http.dll were missing.
The php header files which define HttpRequest, HttpResponse etc are not there.
These php header files are suppost to be in

include_path=....\php\PEAR

but they are not. Any other class is defined there.

The problem is that the downloaded package does contain the dll to be copied to ..../php/ext, but not the php header files to be copied to .../php/PEAR/HTTP.

And that would explain why the dll is loading correctly (I think) but does not show up in phpinfo(), because the necessary php header files are not there to make it to the list. Which is from the php admin point of view ok and therefore no error message. And the php_http.dll is just sitting there doing nothing.

So, my question is now where to get the php header files from?
Alex R4
 
Posts: 31
Joined: 08. April 2014 11:24
Location: Adelaide/Australia
Operating System: Windows 7

Re: Unable to add extension php_http.dll

Postby gsmith » 27. December 2014 19:04

I mentioned "complete list of dependencies" on http://pecl.php.net/package/pecl_http for a reason.
One of those dependencies is also PEAR ... so I think that would be a good next step.
http://pear.php.net/package/PEAR
gsmith
 
Posts: 194
Joined: 29. November 2013 18:04
Location: San Diego
XAMPP version: 0.0.0
Operating System: Win XP to 2012R2/VS 6,9,11,14

Re: Unable to add extension php_http.dll

Postby Alex R4 » 29. December 2014 08:50

gsmith wrote:I mentioned "complete list of dependencies" on http://pecl.php.net/package/pecl_http for a reason.

Yeah, right. I call that tunnel vision, reading only things I want to see. I read at least 10 times past this paragraph without noticing that dependency. Incidentally, my wife is complaining about that feature of my brain for years to my family and friends.

So I actioned on that dependency and dowloaded, installed, tested the pear package manager. All good.

Then I had a go at the real thing:

I:\Project\src\php>pecl install pecl_http
downloading pecl_http-2.1.4.tgz ...
Starting to download pecl_http-2.1.4.tgz (159,005 bytes)
..................................done: 159,005 bytes
downloading raphf-1.0.4.tgz ...
Starting to download raphf-1.0.4.tgz (7,232 bytes)
...done: 7,232 bytes
downloading propro-1.0.0.tgz ...
Starting to download propro-1.0.0.tgz (6,217 bytes)
...done: 6,217 bytes
4 source files, building
WARNING: php_bin I:\Project\src\php\php.exe appears to have a suffix .exe, but config variable php_suffix does not match
ERROR: The DSP raphf.dsp does not exist.
3 source files, building
WARNING: php_bin I:\Project\src\php\php.exe appears to have a suffix .exe, but config variable php_suffix does not match
ERROR: The DSP propro.dsp does not exist.
64 source files, building
WARNING: php_bin I:\Project\src\php\php.exe appears to have a suffix .exe, but config variable php_suffix does not match
ERROR: The DSP pecl_http.dsp does not exist.
I:\Project\src\php>

I had a look into the pecl.bat file to see whether I could tweek something. After I read through the file I went for a long walk on the beach. Do I need this? Is that my personalised proverbial can of worms?
I came back and decided that this little project is beyond my intellectual capabilities.
Sorry guys, five days after intense trail and error, I'm throwing the towel at this one.

Thanks everyone for helping. That chapter is now closed.
Alex R4
 
Posts: 31
Joined: 08. April 2014 11:24
Location: Adelaide/Australia
Operating System: Windows 7

Re: Unable to add extension php_http.dll

Postby Nobbie » 29. December 2014 11:55

You may give it a last try - with a linux server instead of Windows. In many many cases the Linux Support is far better than the Windows Support. Simply install a server distribution (of Ubuntu for example) and try to install everything from the repositories (using the Ubuntu Software Center).
Nobbie
 
Posts: 8762
Joined: 09. March 2008 13:04

Re: Unable to add extension php_http.dll

Postby Alex R4 » 30. December 2014 02:01

Nobbie wrote:In many many cases the Linux Support is far better than the Windows Support.

Yep, I thought that may be the case based on the amount of documentation I went through.
The thing is, that would take me even further away from my original goal of issuing a HttpRequest to a secondary server, get the HttpResponse and that would be it.
Instead of just implementing an add-on (I estimated 2 hours for this job, max 5 hours), I'm wading knee-deep in php internals, pears and pecls, and if RedHat do this and if Solaris do that, and if version 99 do some other things.<add your favorite expletive here>

Don't get me wrong, I like using php as a server language, but in the last 6 days I have seen the limitations of the application. From now on I stick with the core system.
Thanks for responding.
Alex R4
 
Posts: 31
Joined: 08. April 2014 11:24
Location: Adelaide/Australia
Operating System: Windows 7

Re: Unable to add extension php_http.dll

Postby Nobbie » 30. December 2014 12:27

Alex R4 wrote:The thing is, that would take me even further away from my original goal of issuing a HttpRequest to a secondary server, get the HttpResponse and that would be it.



In that case, the PECL and php_http.dll is a clear overkill, you simply may build your own HTTP Request and send (and read) it via fsockopen() function. I did that already years ago and its real simple. HTTP is a very easy protocol. Already the first example of fsockopen() function shows up how to issue a HTTP Request to a remote server:

http://php.net/manual/en/function.fsockopen.php

If you see the output, you will find the Headers (like Content-Type etc.) and it is very easy to parse for certain values.
Nobbie
 
Posts: 8762
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 45 guests