Link to home
Start Free TrialLog in
Avatar of phpzilla
phpzilla

asked on

How to fix failed communications with Payment Gateways in PHP using Curl/SOAP

My server is showing communication errors with the PayPal SDK, Google API, and other remote servers in the php error log.

Is a 1-2% failure rate for communicating with other servers acceptable?

Where do I start looking to optimize?  I am running a LAMP system.

Do I optimize something in php.ini for CURL and SOAP?
Avatar of Andrew Angell
Andrew Angell
Flag of United States of America image

What is the timeout setting you have set?  You might want to try adding a little more time on that and see if that helps.
Avatar of phpzilla
phpzilla

ASKER

Timeout settings where?  php.ini, the gateway api, ...

How do I diagnose failed communications on linux, is there a log file?
Look into this:  http://www.php.net/manual/en/function.set-time-limit.php

And check this out:  http://stackoverflow.com/questions/2582057/setting-curls-timeout-in-php

The first one is about setting it up in php.ini or setting it in code.  The second one is regarding the CURL timeout specifically.
Is a 1-2% failure rate for communicating with other servers acceptable?
"Acceptable" is a pretty broad term.  Some questions to help run this to ground...

Are you on a shared server?

What PHP functions are causing the "communications errors?"

Are you using cURL error reporting?

Have you tried fsockopen() to speak with the APIs?
using curl

Should I always set CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT?

Are system defaults set somewhere for CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT?

Does /etc/php5/apache2/phi.ini->max_execution_time affect CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT or does max_execution_time get suspeneded with a call is made to an external system via curl?

is there a difference with curl in apache (browser) vs cli (command line cron jobs?)
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial