Jump to content

Archived

This topic is now archived and is closed to further replies.

sonicsquirl

Cant open any SSL sites with CuRL, fopen, fsock -> Please help

Recommended Posts

Hello, I have a problem that is driving me crazy.

On my dev server im running PHP 4.3.4 (Suse 9.1)
On my live server im running PHP 5.1.4 (cli) (built: May 30 2006 19:34:33) (fedorac core4)

I have a very simple piece of code that acts very different on both. on my dev it works on my live it dosnt.

heres the code. (ive replace the url with paypal because i cant put the url of the client whos page im trying to read - with his permission).

<?php
// create a new curl resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://www.paypal.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close curl resource, and free up system resources
curl_close($ch);
?>

heres what i get on my live server

*** glibc detected *** php: free(): invalid pointer: 0x00c9cc00 ***
======= Backtrace: =========
/lib/libc.so.6[0x624424]
/lib/libc.so.6(__libc_free+0x77)[0x62495f]
/usr/lib/libmysqlclient.so.15(_ZdlPvN5yaSSL5new_tE+0x23)[0x4812b3]
/usr/lib/libmysqlclient.so.15(_ZN5yaSSL8ysDeleteINS_10SSL_METHODEEEvPT_+0x24)[0x479674]
/usr/lib/libmysqlclient.so.15(_ZN5yaSSL7SSL_CTXD1Ev+0x2a)[0x484f8a]
/usr/lib/libmysqlclient.so.15(_ZN5yaSSL8ysDeleteINS_7SSL_CTXEEEvPT_+0x26)[0x479286]
/usr/lib/libmysqlclient.so.15(SSL_CTX_free+0x1f)[0x474a5f]
/usr/lib/libcurl.so.3(Curl_SSL_Close+0x7f)[0x9dd627]
/usr/lib/libcurl.so.3(Curl_disconnect+0x10b)[0x9d7699]
/usr/lib/libcurl.so.3(Curl_connect+0x91e)[0x9da252]
/usr/lib/libcurl.so.3[0x9e4074]
/usr/lib/libcurl.so.3(Curl_perform+0xe3)[0x9e6311]
/usr/lib/libcurl.so.3(curl_easy_perform+0x36)[0x9e68f1]
php(zif_curl_exec+0x6e)[0x80b3bba]
php[0x8254705]
/usr/local/Zend/lib/Optimizer-2_6_2/php-5.1.x/ZendOptimizer.so[0x35f4db]
[0x85bedc4]
======= Memory map: ========
00111000-0021b000 r-xp 00000000 09:02 14590077  /usr/lib/libxml2.so.2.6.19
0021b000-00223000 rwxp 00109000 09:02 14590077  /usr/lib/libxml2.so.2.6.19
00223000-00224000 rwxp 00223000 00:00 0
00224000-0031c000 r-xp 00000000 09:02 16974876  /lib/libcrypto.so.0.9.7f
0031c000-0032e000 rwxp 000f8000 09:02 16974876  /lib/libcrypto.so.0.9.7f
0032e000-00331000 rwxp 0032e000 00:00 0
00331000-00333000 r-xp 00000000 09:02 15073842  /usr/local/Zend/lib/ZendExtensionManager.so
00333000-00334000 rwxp 00001000 09:02 15073842  /usr/local/Zend/lib/ZendExtensionManager.so
00334000-0033d000 r-xp 00000000 09:02 16973877  /lib/libnss_files-2.3.5.so
0033d000-0033e000 r-xp 00008000 09:02 16973877  /lib/libnss_files-2.3.5.so
0033e000-0033f000 rwxp 00009000 09:02 16973877  /lib/libnss_files-2.3.5.so
0033f000-003b6000 r-xp 00000000 09:02 15073871  /usr/local/Zend/lib/Optimizer-2_6_2/php-5.1.x/ZendOptimizer.so
003b6000-003c1000 rwxp 00077000 09:02 15073871  /usr/local/Zend/lib/Optimizer-2_6_2/php-5.1.x/ZendOptimizer.so
003c1000-003c3000 rwxp 003c1000 00:00 0
003c3000-003cc000 r-xp 00000000 09:02 16974880  /lib/libgcc_s-4.0.0-20050520.so.1
003cc000-003cd000 rwxp 00009000 09:02 16974880  /lib/libgcc_s-4.0.0-20050520.so.1
00403000-004b1000 r-xp 00000000 09:02 6488228    /usr/lib/libmysqlclient.so.15.0.0
004b1000-005c1000 rwxp 000ad000 09:02 6488228    /usr/lib/libmysqlclient.so.15.0.0
005c1000-006e5000 r-xp 00000000 09:02 16974873  /lib/libc-2.3.5.so
006e5000-006e7000 r-xp 00124000 09:02 16974873  /lib/libc-2.3.5.so
006e7000-006e9000 rwxp 00126000 09:02 16974873  /lib/libc-2.3.5.so
006e9000-006eb000 rwxp 006e9000 00:00 0
00795000-007af000 r-xp 00000000 09:02 16974872  /lib/ld-2.3.5.so
007af000-007b0000 r-xp 00019000 09:02 16974872  /lib/ld-2.3.5.so
007b0000-007b1000 rwxp 0001a000 09:02 16974872  /lib/ld-2.3.5.so
0082c000-0082d000 r-xp 0082c000 00:00 0
008df000-00901000 r-xp 00000000 09:02 16974879  /lib/libm-2.3.5.so
00901000-00902000 r-xp 00021000 09:02 16974879  /lib/libm-2.3.5.so
00902000-00903000 rwxp 00022000 09:02 16974879  /lib/libm-2.3.5.so
00905000-00907000 r-xp 00000000 09:02 16974875  /lib/libdl-2.3.5.so
00907000-00908000 r-xp 00001000 09:02 16974875  /lib/libdl-2.3.5.so
00908000-00909000 rwxp 00002000 09:02 16974875  /lib/libdl-2.3.5.so
0090b000-00910000 r-xp 00000000 09:02 16974885  /lib/libcrypt-2.3.5.so
00910000-00911000 r-xp 00004000 09:02 16974885  /lib/libcrypt-2.3.5.so
00911000-00912000 rwxp 00005000 09:02 16974885  /lib/libcrypt-2.3.5.so
00912000-00939000 rwxp 00912000 00:00 0
0093b000-0094d000 r-xp 00000000 09:02 14584749  /usr/lib/libz.so.1.2.2.2
0094d000-0094e000 rwxp 00011000 09:02 14584749  /usr/lib/libz.so.1.2.2.2
00963000-00975000 r-xp 00000000 09:02 16974884  /lib/libnsl-2.3.5.so
00975000-00976000 r-xp 00011000 09:02 16974884  /lib/libnsl-2.3.5.so
00976000-00977000 rwxp 00012000 09:02 16974884  /lib/libnsl-2.3.5.so
00977000-00979000 rwxp 00977000 00:00 0
0097b000-0098a000 r-xp 00000000 09:02 16973937  /lib/libresolv-2.3.5.so
0098a000-0098b000 r-xAborted

Ive tryed to open urls with fopen and fsock too. they both fail. fopen even gives me a seg fault.

Now, here's the kicker.. if your try http://paypal.com as a url it works. And ive tryed this on lots of sites.

So basicaly i can read any remote urls if they have ssl and i really need to.


please, please help. in 5 years of development ive never asked for help but im pressed for time.

thank you


Share this post


Link to post
Share on other sites
[quote]raul at navenetworks dot com
21-Jul-2004 01:19
Hi!

I have found some information I am sure it could help lot of programmers when they want to connect with curl to any https website and they haven't a good or right CA Cert :)

I give you just one example It has resolved me 2 hours of my time looking for a solution.

It is simple, just if you get any error in the curl_exec (use curl_error(...) to see the error to trace it) add the next line and everything is solved:

(note: replace $ch with the right curl variable)

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

<?php

$ch = curl_init();
$res= curl_setopt ($ch, CURLOPT_URL,"https://yoururl/cgi");

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "Idc=si&");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$xyz = curl_exec ($ch);

curl_close ($ch);
echo $xyz;
if ($xyz == NULL) {
          echo "Error:<br>";
          echo curl_errno($ch) . " - " . curl_error($ch) . "<br>";
}
?>

I hope this helps.

Raul Mate Galan
Ceo Navenetworks Corp.[/quote]

Share this post


Link to post
Share on other sites
still no dice.

here's what i get.



*** glibc detected *** php: free(): invalid pointer: 0x00c9cc00 ***
======= Backtrace: =========
/lib/libc.so.6[0x816424]
/lib/libc.so.6(__libc_free+0x77)[0x81695f]
/usr/lib/libmysqlclient.so.15(_ZdlPvN5yaSSL5new_tE+0x23)[0x18f2b3]
/usr/lib/libmysqlclient.so.15(_ZN5yaSSL8ysDeleteINS_10SSL_METHODEEEvPT_+0x24)[0x187674]
/usr/lib/libmysqlclient.so.15(_ZN5yaSSL7SSL_CTXD1Ev+0x2a)[0x192f8a]
/usr/lib/libmysqlclient.so.15(_ZN5yaSSL8ysDeleteINS_7SSL_CTXEEEvPT_+0x26)[0x187286]
/usr/lib/libmysqlclient.so.15(SSL_CTX_free+0x1f)[0x182a5f]
/usr/lib/libcurl.so.3(Curl_SSL_Close+0x7f)[0x9dd627]
/usr/lib/libcurl.so.3(Curl_disconnect+0x10b)[0x9d7699]
/usr/lib/libcurl.so.3(Curl_connect+0x91e)[0x9da252]
/usr/lib/libcurl.so.3[0x9e4074]
/usr/lib/libcurl.so.3(Curl_perform+0xe3)[0x9e6311]
/usr/lib/libcurl.so.3(curl_easy_perform+0x36)[0x9e68f1]
php(zif_curl_exec+0x6e)[0x80b3bba]
php[0x8254705]
/usr/local/Zend/lib/Optimizer-2_6_2/php-5.1.x/ZendOptimizer.so[0x2fa4db]
[0x8ed8d74]
======= Memory map: ========
00111000-001bf000 r-xp 00000000 09:02 6488228    /usr/lib/libmysqlclient.so.15.0.0
001bf000-002cf000 rwxp 000ad000 09:02 6488228    /usr/lib/libmysqlclient.so.15.0.0
002cf000-002d8000 r-xp 00000000 09:02 16973877  /lib/libnss_files-2.3.5.so
002d8000-002d9000 r-xp 00008000 09:02 16973877  /lib/libnss_files-2.3.5.so
002d9000-002da000 rwxp 00009000 09:02 16973877  /lib/libnss_files-2.3.5.so
002da000-00351000 r-xp 00000000 09:02 15073871  /usr/local/Zend/lib/Optimizer-2_6_2/php-5.1.x/ZendOptimizer.so
00351000-0035c000 rwxp 00077000 09:02 15073871  /usr/local/Zend/lib/Optimizer-2_6_2/php-5.1.x/ZendOptimizer.so
0035c000-0035e000 rwxp 0035c000 00:00 0
0035e000-00362000 r-xp 00000000 09:02 16973874  /lib/libnss_dns-2.3.5.so
00362000-00363000 r-xp 00003000 09:02 16973874  /lib/libnss_dns-2.3.5.so
00363000-00364000 rwxp 00004000 09:02 16973874  /lib/libnss_dns-2.3.5.so
00364000-0036d000 r-xp 00000000 09:02 16974880  /lib/libgcc_s-4.0.0-20050520.so.1
0036d000-0036e000 rwxp 00009000 09:02 16974880  /lib/libgcc_s-4.0.0-20050520.so.1
003cb000-00403000 r-xp 00000000 09:02 14590251  /usr/local/lib/libmhash.so.2.0.0
00403000-00404000 rwxp 00037000 09:02 14590251  /usr/local/lib/libmhash.so.2.0.0
00404000-0050e000 r-xp 00000000 09:02 14590077  /usr/lib/libxml2.so.2.6.19
0050e000-00516000 rwxp 00109000 09:02 14590077  /usr/lib/libxml2.so.2.6.19
00516000-00517000 rwxp 00516000 00:00 0
006a0000-006a1000 r-xp 006a0000 00:00 0
00795000-007af000 r-xp 00000000 09:02 16974872  /lib/ld-2.3.5.so
007af000-007b0000 r-xp 00019000 09:02 16974872  /lib/ld-2.3.5.so
007b0000-007b1000 rwxp 0001a000 09:02 16974872  /lib/ld-2.3.5.so
007b3000-008d7000 r-xp 00000000 09:02 16974873  /lib/libc-2.3.5.so
008d7000-008d9000 r-xp 00124000 09:02 16974873  /lib/libc-2.3.5.so
008d9000-008db000 rwxp 00126000 09:02 16974873  /lib/libc-2.3.5.so
008db000-008dd000 rwxp 008db000 00:00 0
008df000-00901000 r-xp 00000000 09:02 16974879  /lib/libm-2.3.5.so
00901000-00902000 r-xp 00021000 09:02 16974879  /lib/libm-2.3.5.so
00902000-00903000 rwxp 00022000 09:02 16974879  /lib/libm-2.3.5.so
00905000-00907000 r-xp 00000000 09:02 16974875  /lib/libdl-2.3.5.so
00907000-00908000 r-xp 00001000 09:02 16974875  /lib/libdl-2.3.5.so
00908000-00909000 rwxp 00002000 09:02 16974875  /lib/libdl-2.3.5.so
0090b000-00910000 r-xp 00000000 09:02 16974885  /lib/libcrypt-2.3.5.so
00910000-00911000 r-xp 00004000 09:02 16974885  /lib/libcrypt-2.3.5.so
00911000-00912000 rwxp 00005000 09:02 16974885  /lib/libcrypt-2.3.5.so
00912000-00939000 rwxp 00912000 00:00 0
0093b000-0094d000 r-xp 00000000 09:02 14584749  /usr/lib/libz.so.1.2.2.2
0094d000-0094e000 rwxp 00011000 09:02 14584749  /usr/lib/libz.so.1.2.2.2
00963000-00975000 r-xp 00000000 09:02 16974884  /lib/libnsl-2.3.5.so
00975000-00976000 r-xp 00011000 09:02 16974884  /lib/libnsl-2.3.5.so
00976000-00977000 rwxp 00012000 09:02 16974884  /lib/libnsl-2.3.5.so
00977000-00979000 rwxp 00977000 00:00 0
0097b000-0098a000 r-xp 00000000 09:02 16973937  /lib/libresolv-2.3.5.so
0098a000-0098b000 r-xp 0000e000 09:02 16973937  /lib/libresolv-2.3.5.so
0098b000-0098c000 rwxp 0000f000 09:02 16973937  /lib/libresolv-2.3.5.so
0098c000-0098e000 rwxp 0098c000 00:00 0
00990000-009be000 r-xp 00000000 09:02 14585709  /usr/lib/libidn.so.11.5.8
009be000-009c0000 rwxp 0002d000 09:02 14585709  /usr/lib/libidn.so.11.5.8
009c2000-009f5000 r-xp 00000000 09:02 14590185  /usr/lib/libcuAborted

Share this post


Link to post
Share on other sites

×

Important Information

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.