Jump to content
xisto Community
vizskywalker

Apache 2, PHP 5.1.4 And cURL

Recommended Posts

I have been running PHP 5.1.4 and Apache 2.2.2 with the PHP 5.2.0 developement phpapache2_2.dll module. I recently installed CURL with php. Now if I run php from the command line, I can use the CURL functions, but not from a webpage through Apache. Also, phpinfo() returns nothing on CURL. I am running Windows XP SP2 and installed PHP manually via the zipped binaries. I really need CURL to work through a webpage and would appreciate any help I can get.~Viz

Share this post


Link to post
Share on other sites

I really don't know if this is the reason, but try using the PHP 5.1.4 version of the Apache module, as it seems that PHP works alright but the connection to Apache is lacking. Or better yet, just download the newest PHP version and check if that works... it should. I got CURL running on Apache2 + PHP 5.x.x quite easily (just downloaded everything from PECL... or is that PEAR?)Good luck!

Share this post


Link to post
Share on other sites

The problem with the PHP 5.1.4 module is that it is incompatible with Apache 2.2.x, only 2.0.x. And I was running Apache 2.2.2. I've downgraded to 2.0.58 and am using the PHP 5.1.4 module. Could you explain how to use PEAR or PECL with windows as I'm unclear on how to do that.~Viz

Share this post


Link to post
Share on other sites

OK, first let's get one thing straight ('cause I keep mixing it up). PEAR is a repository for PHP libraries, written in PHP code, while PECL is a repository of PHP extensions, written in C++ and compiled to DLL files (for Windows).

 

Just download the collection of PECL modules for PHP 5.1.4, which has all the usual standard PECL extensions (you won't need other PECL extensions for most PHP programs) and unzip it into the "ext" folder inside your PHP installation directory. Now all you have to do is go into your "php.ini" configuration file, and search for "Dynamic Extensions", and under it you'll find lots of lines that begin with ";extension = " and then the name of an extension, so just uncomment (remove the semi-colon at the beginning) the extensions you want. Be aware though that some extensions rely on other extensions, so if after you enable a few extensions PHP won't start, try pinpointing the specific extension (turn PHP on with less extensions) and post back!

 

Good luck!

Edited by seec77 (see edit history)

Share this post


Link to post
Share on other sites

I essentially did that, I have the php_curl.dll and have uncommented the extension. But I still have problems using the curl libraryof functions if I go through Apache. Using the php compiler from command line works just fine. All other php functions work fine through Apache (at least, all the others I've installed).~Viz

Share this post


Link to post
Share on other sites

Installation

 

To use PHP's CURL support you must also compile PHP --with-curl[=DIR] where DIR is the location of the directory containing the lib and include directories. In the "include" directory there should be a folder named "curl" which should contain the easy.h and curl.h files. There should be a file named libcurl.a located in the "lib" directory. Beginning with PHP 4.3.0 you can configure PHP to use CURL for URL streams --with-curlwrappers.

 

Note to Win32 Users: In order to enable this module on a Windows environment, libeay32.dll and ssleay32.dll must be present in your PATH.

 

You don't need libcurl.dll from the CURL site.

 


Now, I don't use this lirary and am not entirely sure if the staement above will actaully help but I came across this and thought it couldn't hurt to post the information.

 

Good luck to you and I hope you'll post your method of installation once you get this working. I'm interested in learning how to use CURL.

 

Hope this helps, :(

 

vujsa

Share this post


Link to post
Share on other sites

Yeah, I've seen that as well, unfortunately, it means compiling php on windows, and the manual isn't to helpful on how to do that. If you can find a manual way to do the same thing it would be most appreciated.~Viz

Share this post


Link to post
Share on other sites

PHP on Windows is always compiled with everything on, as far as I know. I think vujsa was pointing out this line:

Note to Win32 Users: In order to enable this module on a Windows environment, libeay32.dll and ssleay32.dll must be present in your PATH.

 

Those two libraries can be found in your base PHP installation directory, next to the PHP executables. Just copy (don't move) them to your "C:\Windows\System32". Maybe you can add the PHP installation directory to your computer's path settings, but I think that the first option is better. Edited by seec77 (see edit history)

Share this post


Link to post
Share on other sites

actually, they are in the path, as my c:\php folder is part of the path, no that part works fine. The problem is definitely in the compile with -with-curl[=DIR]. Otherwise, I wouldn't be able to use the functions at all, and I can, just not through a webservice.~Viz

Share this post


Link to post
Share on other sites

Okay, I set PHP to indicate problems at startup. I get this alert

PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_curl.dll' - The operating system cannot run %1

twice. And I have PHP installed properly, everything else works, currently running PHP 5.1.4 and Apache 2.058. I have uncommented the line 'extension=php_curl.dll' and php_curl.dll is in the C:\PHP\ext directory. I have set the PATH environment variable to include c:\php which is where I have php. Any ideas would be helpful.
~Viz

Share this post


Link to post
Share on other sites

Okay, I got it working. However, I am not completely happy with the method required to get it working. It turns out that libeay.dll and ssleay.dll do not need to be present in your path, they need to be present in c:\windows\system32. So now that they reside there, it works. I haven't checked with Apache 2.2.2 (and the PHP 5.20 release Apache module (which by the way is recommended by Apache for use with php 5.1.4 (I think))) but it should work fine.Thanks for all the suggestions.~Viz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.