4

Im using the ci-merchant library in my PyroCMS module locally on my development WAMP server. (all working fine)

When I upload to my Linux test server the purchase() function being called does not seem to work.

When it executes it pools for 5 minutes then I get a response "Could not connect to host".

PHP

$params = 
        array( 
            'amount' => 20,
            'currency' =>  'USD',
            'return_url' => 'http://someurl.com/return/'
            'cancel_url' => 'http://someurl.com/cancel/'
         );

$settings = array(
        'test_mode' => TRUE,
        'username' => 'PAYPAL_TEST_USERNAME'
        'password' => 'MY_PAPAL_TEST_PASS' 
        'signature' => 'MY_PAYPAL_TEST_SIG' 
        );

$this->load->library('merchant');
$this->merchant->load('paypal_express');
$this->merchant->initialize($settings);  


//this is where Im having the issue
$response = $this->merchant->purchase($params);

$message = $response->message();

When I echo $message

echo $message; //Outputs: couldn't connect to host"

CURL - Server Settings

Below is a list of the differences in the CURL settings on the servers. Perhaps this is the issue. I dont think these settings can be changed without having to compile curl but im not sure.

Development Server (WAMP server - status:Working)

AsynchDNS : Yes
CurlInfo  : 7.21.7 
GSS Neg   : Yes
IDN       : No
SSPI      : Yes
libSSH    : libssh2/1.2.7 

Test Server (Linuxserver - status:Not working)

AsynchDNS : No
CurlInfo  : 7.24.0  
GSS Neg   : No  
IDN       : Yes
SSPI      : No
libSSH    : <<not listed>>
IEnumerable
  • 3,610
  • 14
  • 49
  • 78
  • Probably a firewall on your test server is preventing outgoing connections. – Adrian Macneil Aug 27 '13 at 16:17
  • Im going to find out about the firewall settings, currently on the test server all I have access to is the cpanel interface. – IEnumerable Aug 28 '13 at 02:18
  • Can you run a quick `curl -v https://api-3t.sandbox.paypal.com/nvp` and `telnet att.com 80` to verify connectivity from your test server? – Robert Aug 29 '13 at 22:04
  • Im currently in the middle of moving servers/host. I will soon have ssh, telnet access. I think may have been a lack of libSSH as the new server worked right out of the box. – IEnumerable Aug 30 '13 at 23:25

1 Answers1

2

After much trial and error and some advice from friends I found this to be a missing libSSH module.

Since then I have moved my site from a shared hosting company to a more reliable VPS Hosting.

I installed the appropriate libraries and everything is working fine.

I would recommend anyone hosting their sites to moving away from any "shared" hosting companies. I only encountered very delayed support and VPS Hosting wasnt really that much more than what I was paying for VPS.

But you will need to know how to manage a server before you do.

IEnumerable
  • 3,610
  • 14
  • 49
  • 78