Error Report for PHP pre-authorization Global Error Receipt after deployment (Solved)

Greetings,

I recently implemented a payment process using the PHP Moneris API (from GitHub). It worked perfectly on my local machine (Windows) however, it stopped working once it was deployed on a Linux server with the following error returned to me:

Array
(
    [ReceiptId] => Global Error Receipt
    [AuthCode] => null
    [Message] => Global Error Receipt
    [ResponseCode] => null
    [TxnNumber] => null
    [CVDResponse] => 
    [ReferenceNum] => null
)

I investigated the issue and found out it came from loading the certificate file before the cURL execution located in the httpsPost class:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$this->url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->dataToSend);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connectTimeOut);
curl_setopt($ch, CURLOPT_TIMEOUT, $clientTimeOut);
curl_setopt($ch, CURLOPT_USERAGENT, $apiVersion);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__).'\curl-ca-bundle.crt');

$this->response=curl_exec ($ch);

curl_close ($ch);

More particularly the backslash (\) made it error out because it wasn't recognized as a proper file location. I suggest using a universal solution for directory separator.

 

Thank you.