Nickbrown.com.au

Internet, Hosting, The Australian Marketplace and a bunch of inane ramblings.

1 May 2008 0 Comments

St George IPG on PHP 5

After the ever-approaching sound of Jared cracking his Work Faster whip behind me, I can confirm the St George Internet Payment Gateway will work on PHP 5.

Scenario – CentOS 5, Apache 2.23, PHP 5.1.6, compat-libstdc++-33, PHP-Devel and Zend Optimizer v3.3.3
Note: The St George IPG will not compile on 64 Bit operating systems, St George have advised that a 64 Bit version is in development.

  1. Download, extract and compile SWIG from www.swig.org as per IPG documentation
  2. Extract the IPG webpayPHP tar
  3. Copy libwebpayclient.so to both /usr/lib/ and /usr/lib/php/modules
  4. Within the webpayPHP directory, run make to compile webpay_php.so. The errors I have seen here are all relatively self explanatory, either SWIG didn’t compile correctly, your on a 64 bit system, PHP Devel or Zend are unavailable
  5. Copy the newly compiled webpay_php.so to /usr/lib/php/modules/
  6. Either set enable_dl = on within your PHP configuration and then restart Apache (Note that enabling dl() imposes major security risks if you have customers hosted on this server) or statically load libwebpayclient.so – You will need to update your actual gateway to reflect this change
  7. The following symlinks needed to be created on a clean CentOS 5 install in order for libwebpayclient.so to meet its dependencies

ln -s /lib/libcrypto.so.0.9.8a /lib/libcrypto.so.4
ln -s /lib/libssl.so.0.9.8a /lib/libssl.so.4

You should now be able to utilise the St George test scripts (After updating test.php to use your Merchant ID, Password, Certificate and correct server address) to confirm it is working correctly.

# php test.php
Starting webpay Transaction
Successfully communicated with the WTS
————————————–
——– TRANSACTION APPROVED ——–
————————————–
Transaction Reference : [2230000001188765]
Result : [0]
Auth Code : [585599]
Response Text : [APPROVED (TEST TRANSACTION ONLY)]
Response Code : [00]
Error Message : []
————————————–
If you receive an error advising that test.php was unable to open libwebpayclient.so run ‘ldd libwebpayclient.so’ to ensure any additional dependencies have been met.

I wish you the best of luck should you actually attempt to contact St George for support, their knowledge of how IPG actually works, let alone their understanding of PHP is severely lacking.

Leave a Reply

You must be logged in to post a comment.