2

I am having a odd problem with the php code below. I have noticed the issue is randomly happened in PHP 5.3.6. It works every times when I run it in PHP 5.2.5. Unfortunately we can downgrade the php due to other OCIs issues with 5.2.5, so we have to use 5.3.6. When the issue is occurred, I don't get any response back at all and it happens randomly. Please help, I need to get this project done asap. Thanks.

<?php
$url = 'https://www.PayEverywhere.com/api/vtapi.aspx?profile_id=XXXXXXXX&profile_key=XXXXXXXXXXXXX&transaction_type=S&card_number=...';  
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_FRESH_CONNECT,TRUE);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($ch,CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);  
if ( ! $response = curl_exec($ch) )
{
    echo "Error " . curl_error($ch). "\n";
}
echo $response;        
curl_close ($ch);
?> 
  • heisenbugs are such fun to diagnose. are you sure it's php 5.3.6? maybe you didn't try enough times with other versions to catch an incident. – Marc B Nov 15 '12 at 18:27
  • I am not 100% sure. Unfortunately, we have 2 dev servers. One is with php 5.3.6 and the other server is 5.2.5. I run the same code in both servers. For 5.2.5, so far I always got the response back. For 5.3.6, I got the response sometimes, and didn't get any response sometimes as well. – user1827483 Nov 15 '12 at 18:45
  • check the curl versions of both servers. curl always gives me headaches – Juris Malinens Nov 15 '12 at 22:17
  • For server with PHP 5.2.5, the cURL Information => libcurl/7.16.0 OpenSSL/0.9.8e zlib/1.2.3. For server with PHP 5.6.3, the cURL Information => 7.21.2 Age => 3 Features AsynchDNS => Yes Debug => No GSS-Negotiate => No IDN => No IPv6 => Yes Largefile => Yes NTLM => Yes SPNEGO => No SSL => Yes SSPI => Yes krb4 => No libz => Yes CharConv => No Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp Host => i386-pc-win32 SSL Version => OpenSSL/0.9.8r ZLib Version => 1.2.3 libSSH Version => libssh2/1.2.7. – user1827483 Nov 16 '12 at 17:44
  • Is anyone knows how to recompile curl with OpenSSL. I found the issue that RIcko M. had before is similar to my issue. He mentioned in his blog answered Jun 29'11 at 9:55 "The problem was NSS. I recompiled curl with OpenSSL and so far it has not shown any issues." (see http://stackoverflow.com/questions/6308842/php-curl-exec-hangs for details). – user1827483 Nov 16 '12 at 23:50

1 Answers1

0

After having retrieved the following archives

http://curl.haxx.se/download.html

http://www.openssl.org/source/

http://web.mit.edu/kerberos/dist/index.html

# Install Curl
./configure --prefix=/curl/prefix --with-ssl=/ssl/prefix --disable-ipv6

# As curl depends on OpenSSL, install OpenSSL
./configure --prefix=/openssl/prefix

# As OpenSSL depends on Kerberos, install Kerberos
./configure --prefix=/kerberos/prefix
Th. Ma.
  • 9,432
  • 5
  • 31
  • 46