473,766 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cURL + OpenSSL + PHP not working

# uname -a
Linux stargate.mxc-online.net 2.4.20-021stab022.2.77 7-smp #1 SMP Wed Jul 28
17:12:37
MSD 2004 i686 i686 i386 GNU/Linux

I recompiled PHP with mcrypt, openssl, and curl
phpinfo(): http://www.canadiandropshipping.com/hello.php3

Does anyone know why this ssl curl test fails?
http://www.canadiandropshipping.com...t/diag_curl.php
it hangs on curl_exec(). I posted the code below.

Here is the easyapache config I used. It compiled without errors. Did I miss
something? Are there known issues with this combination of software?

/scripts/easyapache
+----------------------- Main Menu ------------------------+
¦ +------------------------------------------------------+ ¦
¦ ¦[ ] Apache 2 Support (Experimental & Very Broken, Not
¦ ¦[*] Expires Module
¦ ¦[*] Raise FD_SETSIZE to 16384 (System Wide)
¦ ¦[*] Prevent Users from reading other webroots
¦ ¦[*] Frontpage Module
¦ ¦[ ] Gzip Module (experimental)
¦ ¦[*] Raise HARD_SERVER_LIM IT
¦ ¦[ ] Perl Module (not required to run .cgi scripts/not
¦ ¦Php Module --->
¦ ¦[ ] PHP suEXEC Support
¦ ¦[*] Report Build Errors to cPanel
¦ ¦[ ] Reset Apache Config to Default (last resort)
¦ ¦[*] Rewrite Module
¦ ¦[ ] Skip Apache Build if up to date
¦ ¦[*] SSL Module
¦ ¦[*] suEXEC Module
¦ ¦[ ] Verbose Build (show configure and gcc output)
¦ +------------------------------------------------------+ ¦
+----------------------------------------------------------+



+-------------------- Php Module Menu ---------------------+
¦ +------------------------------------------------------+ ¦
¦ ¦[*] Php Module
¦ ¦ (*) Version 4.3.10
¦ ¦ ( ) Version 4.3.8
¦ ¦ ( ) Version 4.3.9
¦ ¦ ( ) Version 5.0.2 (TESTING)
¦ ¦ ( ) Version 5.0.3 (TESTING)
¦ ¦ (*) Bc Math
¦ ¦ (*) Calendar Support
¦ ¦ (*) Curl
¦ ¦ (*) Curl SSL Support
¦ ¦ (*) Dom XSLT
¦ ¦ ( ) Exif
¦ ¦ ( ) Flash
¦ ¦ (*) FTP
¦ ¦ (*) GD
¦ ¦ ( ) GetText
¦ ¦ ( ) Iconv (experimental)
¦ ¦ ( ) Imap Module
¦ ¦ ( ) Java (must already be installed, or install w
¦ ¦ ( ) Mb String
¦ ¦ (*) Mcrypt
¦ ¦ ( ) Memory Limit (experimental)
¦ ¦ ( ) Mhash
¦ ¦ ( ) Ming Support
¦ ¦ (*) Magic Quotes
¦ ¦ (*) Mysql Module
¦ ¦ (*) Openssl Support
¦ ¦ (*) Discard Path
¦ ¦ ( ) PDFlib (requires license for commerical use;
¦ ¦ (*) Pear
¦ ¦ ( ) Postgresql (will break 7.2.x or earlier, plea
¦ ¦ ( ) Pspell Module
¦ ¦ ( ) Sablot XSLT [may cause problems with chili!as
¦ ¦ ( ) SafeMode
¦ ¦ (*) Sockets
¦ ¦ ( ) Use System Mysql
¦ ¦ (*) Track Vars
¦ ¦ ( ) Freetype Support
¦ ¦ (*) Versioning
¦ ¦ ( ) WDDX
¦ ¦ ( ) XML RPC
¦ ¦ ( ) Zip
¦ ¦ (*) Zlib
¦ +------------------------------------------------------+ ¦
+----------------------------------------------------------¦
PHP Code:
<?
/*
file created on 2/23/2004 to test CURL
*/

function ssl_connect($ur l,$variables=0, $parse_variable s=0,$
test=0,$timeout =30,$no_headers =0){
global $SC;
define(UMURL,$u rl);
define(UMTIMEOU T,$timeout);

// check for presence of CURL
if (!function_exis ts("curl_init") ){
// only display CURL error message if it hasn't been displayed
before
if (!$SC['no_curl']) print "\n<!-- Squirrelcart Error: You are using
a service which requires CURL, and it is not enabled on your web
server. -->";
$SC['no_curl'] = 1;
return;
}
// if URL has https in it, check for presence of OpenSSL

$ch = curl_init(UMURL );

// set some options for the connection
curl_setopt($ch , CURLOPT_HEADER, 1);
curl_setopt($ch ,CURLOPT_TIMEOU T,UMTIMEOUT);
curl_setopt($ch ,CURLOPT_RETURN TRANSFER,1);
if (strtoupper(sub str(PHP_OS,0,3) ) == 'WIN') {
curl_setopt($ch , CURLOPT_SSL_VER IFYPEER, FALSE); // this line fixes
SSL communications on some Windows servers (IIS 5.0?)
}
//curl_setopt($ch ,CURLOPT_VERBOS E,1);
// attach the data
//print "query is $query<br>";

// run the transfer
$result=curl_ex ec ($ch);
if(curl_errno($ ch) > 0) echo "<p style='color: red'><b>cURL
ERROR#".curl_er rno($ch).": ".curl_error($c h)." at ".__LINE__. " in
".__FILE__. "</b></p>";
curl_close ($ch);
return $result;
}
print "<html><head><t itle>CURL Test Page</title></head><body
style=\"font-family: verdana, helvetica, tahoma; font-size: 12pt\"><b>CURL
Test Page</b><br><br>To test a regular HTTP connection via curl to
http://www.ebay.com,
<br>
<a href=\"?method= normal\">click here</a><br><br>
";
print "To test a secure HTTPS (SSL) connection via curl to
https://adwords.google.com/select/
<br>
<a href=\"?method= secure\">click here</a><br>";
if ($HTTP_GET_VARS['method']) {
print "<br><b>If a page is displayed below, the test worked. Do not
worry about broken image tags. As long as you have some output from the page
below the test is valid:</b><hr width=\"100%\" height=\"2\"><b r><br>";

if ($HTTP_GET_VARS['method'] == "normal") $page = "http://www.ebay.com";
if ($HTTP_GET_VARS['method'] == "secure") $page =
"https://adwords.google. com/select/";
$page_data = ssl_connect($pa ge);
print $page_data;
}

print "</body></html>";

?>

Jul 17 '05 #1
3 6331
Your test link is still broken and your email address still doesn't work.
I've tried to help -- again -- but can't so I'll repeat what I said before:
are you sure curl is compiled into apache? And that all this is going to
work with easyapache?

John

"Chris Fortune" <hey.spammer... ju******@job.or g> wrote in message
news:Oo73e.1050 01$KI2.7292@clg rps12...
# uname -a
Linux stargate.mxc-online.net 2.4.20-021stab022.2.77 7-smp #1 SMP Wed Jul 28 17:12:37
MSD 2004 i686 i686 i386 GNU/Linux

I recompiled PHP with mcrypt, openssl, and curl
phpinfo(): http://www.canadiandropshipping.com/hello.php3

Does anyone know why this ssl curl test fails?
http://www.canadiandropshipping.com...t/diag_curl.php
it hangs on curl_exec(). I posted the code below.

Here is the easyapache config I used. It compiled without errors. Did I miss something? Are there known issues with this combination of software?

/scripts/easyapache
+----------------------- Main Menu ------------------------+
¦ +------------------------------------------------------+ ¦
¦ ¦[ ] Apache 2 Support (Experimental & Very Broken, Not
¦ ¦[*] Expires Module
¦ ¦[*] Raise FD_SETSIZE to 16384 (System Wide)
¦ ¦[*] Prevent Users from reading other webroots
¦ ¦[*] Frontpage Module
¦ ¦[ ] Gzip Module (experimental)
¦ ¦[*] Raise HARD_SERVER_LIM IT
¦ ¦[ ] Perl Module (not required to run .cgi scripts/not
¦ ¦Php Module --->
¦ ¦[ ] PHP suEXEC Support
¦ ¦[*] Report Build Errors to cPanel
¦ ¦[ ] Reset Apache Config to Default (last resort)
¦ ¦[*] Rewrite Module
¦ ¦[ ] Skip Apache Build if up to date
¦ ¦[*] SSL Module
¦ ¦[*] suEXEC Module
¦ ¦[ ] Verbose Build (show configure and gcc output)
¦ +------------------------------------------------------+ ¦
+----------------------------------------------------------+



+-------------------- Php Module Menu ---------------------+
¦ +------------------------------------------------------+ ¦
¦ ¦[*] Php Module
¦ ¦ (*) Version 4.3.10
¦ ¦ ( ) Version 4.3.8
¦ ¦ ( ) Version 4.3.9
¦ ¦ ( ) Version 5.0.2 (TESTING)
¦ ¦ ( ) Version 5.0.3 (TESTING)
¦ ¦ (*) Bc Math
¦ ¦ (*) Calendar Support
¦ ¦ (*) Curl
¦ ¦ (*) Curl SSL Support
¦ ¦ (*) Dom XSLT
¦ ¦ ( ) Exif
¦ ¦ ( ) Flash
¦ ¦ (*) FTP
¦ ¦ (*) GD
¦ ¦ ( ) GetText
¦ ¦ ( ) Iconv (experimental)
¦ ¦ ( ) Imap Module
¦ ¦ ( ) Java (must already be installed, or install w
¦ ¦ ( ) Mb String
¦ ¦ (*) Mcrypt
¦ ¦ ( ) Memory Limit (experimental)
¦ ¦ ( ) Mhash
¦ ¦ ( ) Ming Support
¦ ¦ (*) Magic Quotes
¦ ¦ (*) Mysql Module
¦ ¦ (*) Openssl Support
¦ ¦ (*) Discard Path
¦ ¦ ( ) PDFlib (requires license for commerical use;
¦ ¦ (*) Pear
¦ ¦ ( ) Postgresql (will break 7.2.x or earlier, plea
¦ ¦ ( ) Pspell Module
¦ ¦ ( ) Sablot XSLT [may cause problems with chili!as
¦ ¦ ( ) SafeMode
¦ ¦ (*) Sockets
¦ ¦ ( ) Use System Mysql
¦ ¦ (*) Track Vars
¦ ¦ ( ) Freetype Support
¦ ¦ (*) Versioning
¦ ¦ ( ) WDDX
¦ ¦ ( ) XML RPC
¦ ¦ ( ) Zip
¦ ¦ (*) Zlib
¦ +------------------------------------------------------+ ¦
+----------------------------------------------------------¦
PHP Code:
<?
/*
file created on 2/23/2004 to test CURL
*/

function ssl_connect($ur l,$variables=0, $parse_variable s=0,$
test=0,$timeout =30,$no_headers =0){
global $SC;
define(UMURL,$u rl);
define(UMTIMEOU T,$timeout);

// check for presence of CURL
if (!function_exis ts("curl_init") ){
// only display CURL error message if it hasn't been displayed
before
if (!$SC['no_curl']) print "\n<!-- Squirrelcart Error: You are using a service which requires CURL, and it is not enabled on your web
server. -->";
$SC['no_curl'] = 1;
return;
}
// if URL has https in it, check for presence of OpenSSL

$ch = curl_init(UMURL );

// set some options for the connection
curl_setopt($ch , CURLOPT_HEADER, 1);
curl_setopt($ch ,CURLOPT_TIMEOU T,UMTIMEOUT);
curl_setopt($ch ,CURLOPT_RETURN TRANSFER,1);
if (strtoupper(sub str(PHP_OS,0,3) ) == 'WIN') {
curl_setopt($ch , CURLOPT_SSL_VER IFYPEER, FALSE); // this line fixes
SSL communications on some Windows servers (IIS 5.0?)
}
//curl_setopt($ch ,CURLOPT_VERBOS E,1);
// attach the data
//print "query is $query<br>";

// run the transfer
$result=curl_ex ec ($ch);
if(curl_errno($ ch) > 0) echo "<p style='color: red'><b>cURL
ERROR#".curl_er rno($ch).": ".curl_error($c h)." at ".__LINE__. " in
".__FILE__. "</b></p>";
curl_close ($ch);
return $result;
}
print "<html><head><t itle>CURL Test Page</title></head><body
style=\"font-family: verdana, helvetica, tahoma; font-size: 12pt\"><b>CURL
Test Page</b><br><br>To test a regular HTTP connection via curl to
http://www.ebay.com,
<br>
<a href=\"?method= normal\">click here</a><br><br>
";
print "To test a secure HTTPS (SSL) connection via curl to
https://adwords.google.com/select/
<br>
<a href=\"?method= secure\">click here</a><br>";
if ($HTTP_GET_VARS['method']) {
print "<br><b>If a page is displayed below, the test worked. Do not
worry about broken image tags. As long as you have some output from the page below the test is valid:</b><hr width=\"100%\" height=\"2\"><b r><br>";

if ($HTTP_GET_VARS['method'] == "normal") $page = "http://www.ebay.com"; if ($HTTP_GET_VARS['method'] == "secure") $page =
"https://adwords.google. com/select/";
$page_data = ssl_connect($pa ge);
print $page_data;
}

print "</body></html>";

?>


Jul 17 '05 #2
Hello Tex John,

The test URL is here:
http://www.canadiandropshipping.com/.../diag_curl.php
strange, the mailing list software seemed to abbreviated it.

How do I test if curl is compiled into apache?

Thanks for your help.

Chris
Jul 17 '05 #3

"Chris Fortune" <hey.spammer... ju******@job.or g> wrote in message
news:hqt3e.1274 66$ZO2.112422@e dtnps84...
Hello Tex John,

The test URL is here:
http://www.canadiandropshipping.com/.../diag_curl.php
strange, the mailing list software seemed to abbreviated it.

How do I test if curl is compiled into apache?

Thanks for your help.

Chris


This works fine on my box (where I just had PHP and Apache recompiled with
curl and openssl).

Well, the first one works so curl works. The other one times out so never
gets around to throwing the curl error. You can try upping your curl timeout
to see if you can get to an error, but I suspect that won't help. Smells
like a server problem.

Something else I would suggest you check is that that outgoing port is open
all the way to the net. Firewalls, routers....

Do you have any SSL certs correctly installed and running which would
indicate SSL was fully functional in Apache? Maybe you can get an idea or
two from here:

http://us2.php.net/manual/en/ref.openssl.php

You may need to switch to a server NG since it looks like PHP is ok unless
something funny is going on with your openssl install.
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2934
by: Haluk Durmus | last post by:
Hello I checked out openssl,mm,apr,apr-util,apache 2,curl,libxml and php from cvs. php couse an ERROR I did the following steps:
8
3337
by: mrbog | last post by:
1. In order to make an http (or https) request with PHP, I need to recompile php with cURL. 2. In order to install CURL I have to upgrade my openssl rpm, even though I'm runing a version of linux that's only like 3 months old (fedora c2 stable), because curl needs libcrypto.so.4. 3. In order to install libcrypto.so.4 I have to upgrade my openssl (took me forever to figure that out).
0
2720
by: Ville Mattila | last post by:
Hello readers, I'm trying to install the latest PHP4 version from the scratch. The configure string is following: ../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-curl --enable-exif --enable-mbsting=all --with-gd --with-openssl --with-zlib-dir=/usr --with-zlib Everything goes well until the cURL should be configured. At that point, I will encounter an error like this:
6
4267
by: Wescotte | last post by:
I'm writing a tiny php app that will log into our bank of america account and retrieve a file containing a list of checks that cleared the previous day. The problem I'm running into is when I perform actions with php/CURL the output is different than when I use IE and I'm completely stumped as to why. The final output should list files available for retrieval but the CURL output displays an error/empty file message. Here is the curl...
1
6610
by: Rory | last post by:
I'm just starting to use cURL and having trouble accessing https pages. All I want to do at this stage is get an https page and display it, just to test the https get is working. However, I always get either a CURLE_OPERATION_TIMEOUTED (28) or CURLE_COULDNT_CONNECT (7) error. I can see from phpinfo() that cURL and SSL are installed, as follows: CURL support enabled CURL Information libcurl/7.12.0 OpenSSL/0.9.6b zlib/1.1.4 but my code...
0
1519
by: jsaint | last post by:
I'm using php 5.1.2 on apache 2.0.54 and am trying to use curl to connect to an ssl server. Curl works fine using http, and the command-line client works with https. But, in php, I just get error 7 when trying to connect through https. So, the problem would seem to be with php's bundled curl support. I am on WinXP, and everything is installed through binaries. Here's an example of my code: $ch = curl_init("https://login.yahoo.com"); ...
2
14688
by: lookee | last post by:
Hello all, I have simple PHP application that on one page strarts session and write some information to it. On another page program tryes to fetch information from a third page using cURL. On that third page program needs to retrive information that were written to the session and use them. Problem is that when I call the third page and call session_start() it starts a new session where there are no infromation I need. Code below. ...
3
2633
by: k.rollman | last post by:
I am having a problem using cURL to create an https connection on a non-standard port (440). Using curl_setopt to set the port to 440 has no effect, and I get the following from curl's verbose output. * About to connect() to xxx.xxx.xxx.xxx port 443 * Connected to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) port 443 If I put ':440' in the url, I get the following and an error code of 7. * About to connect() to xxx.xxx.xxx.xxx port 440
11
3724
by: Flexor | last post by:
I have a php script that runs from command line and makes an https request to paypal, using curl. It works fine if I run it from a web page. It fails if I run it from CLI. The error I get from the CLI: * About to connect() to api-3t.sandbox.paypal.com port 443 * Trying 216.113.191.88... * connected * Connected to api-3t.sandbox.paypal.com (216.113.191.88) port 443 * successfully set certificate verify locations: * CAfile:...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10008
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.