Skip to main content

How to fix "PAYMENTECH_HOME must be defined for CGI applications to work" error while using paymentech Orbital Perl SDK?

"PAYMENTECH_HOME must be defined for CGI applications to work" - How to fix this error happened while using Chase paymentech Orbital Perl SDK?


This topic cover the issue of not passing of Environment variables from Apache to CGI scripts

Following error is occuring some times when trying to use PAYMENTECH perl SDK:

Software error:
PAYMENTECH_HOME must be defined for CGI applications to work
BEGIN failed--compilation aborted at /usr/local/share/perl5/Paymentech/CGI.pm line 47.
Compilation failed in require at paymentprocessor.pl line 25.
BEGIN failed--compilation aborted at paymentprocessor.pl line 25.



Chase Paymentech offers Payment gateways for processing credit card payments for eCommerce websites. One of their products, Orbital Payment Gateway which uses a Perl SDK which is to installed on the server and a perl script will use this SDK to generate calls to paymentech server to process the payment and return the result of transaction to the user.



Process happens something like this:

Suppose your site is a PHP driven ECommerce website, After the checkout process , website submits payment info along with Credit card information to a Perl script on your server's CGI location. The perl script will be using the SDK which is installed on the server and the script uses the SDK function to process the payment info and return the result of the transaction to the user.

The above mentioned error happened in the "paymentprocessor.pl" script and this is the page where the payment info is submitted from the PHP side of the website.

There will be statement like the one given below, which will try to load the SDK module

use Paymentech::CGI;

But on some conditions CGI script may not be able to access the Environment variable PAYMENTECH_HOME which tells the location of SDK. That is sometimes when CGI sciript runs under apache the system doesn't pass the PAYMENTECH_HOME variable to the script.

One reason for this is, when the CGI (common gateway interface) is running in a suEXEC environment, the environment variable may get unaccessible. The suexec module gets readded or uncommented within the apache configuration file so in order to fix this issue, we have to comment out the line and restart apache. Perl Payment scripts required an environment variable, PAYMENTECH_HOME, to be set. As suEXEC scrubs the environment that is passed to the CGI scripts, this variable is not being passed correctly, which was causing perl script failing. to fix this disable suEXEC module completely. This happens when the Plesk or Apache is updated and config file is rewritten.

To disable suEXEC, the following line was commented in /etc/httpd/conf/httpd.conf and Apache was restarted:


[code]
#LoadModule suexec_module modules/mod_suexec.so
[/code]


Another situation:

If I define it like
export $PAYMENTECH_HOME=/usr/local/paymentech from the shell before I run perl script.cgi everything works fine.But if I run it under apache the system doesn't pass the PAYMENTECH_HOME variable to the script.

- One option is to define the Environment variable in Environment variable file. Find the File so you could put your definition right in somewhere near the top of the file. Ie, add an export MYVAR=value line to envvars (should be located in /etc/apache2) or the script that starts apache (in /etc/init.d), and add your PassEnv MYVAR where it's wanted in your apache configuration.

export PAYMENTECH_HOME=/usr/local/paymentech

- Other option is to use the "PassEnv" and "SetEnv" directives in httpd.conf to tell apache to pass certain environment variables from its own environment to any CGI scripts being run.

Apache Module mod_env has the functions for this. click MOD_ENV to learn more about this Apache module or visit : http://httpd.apache.org/docs/2.2/mod/mod_env.html


Reference links:
  • Apache.org suEXEC :www.httpd.apache.org/docs/2.2/suexec.html 
  • What Wiki pedia says about SuEXEC : http://en.wikipedia.org/wiki/SuEXEC
  • Environment Variables in Apache : http://httpd.apache.org/docs/2.2/env.html
  • Apache Module mod_env : http://httpd.apache.org/docs/2.2/mod/mod_env.html
  • Common gateway interface (CGI) : http://en.wikipedia.org/wiki/Common_Gateway_Interface
  • Start Apache web server : https://httpd.apache.org/docs/2.2/invoking.html
  • Stop Apache web server : https://httpd.apache.org/docs/2.2/stopping.html
  • Restart Apache web server : http://webdesign.about.com/cs/apache/ht/htapacherestart.htm


What is suExec
The suEXEC feature provides Apache users the ability to run CGI and SSI programs under user IDs different from the user ID of the calling web server. Apache suEXEC is a feature of the Apache Web server. It allows users to run CGI and SSI applications as a different user - normally, all web server processes run as the default web server user (often wwwrun, Apache or nobody). The suEXEC feature consists of a module for the web server and a binary executable which acts as a wrapper. suEXEC was introduced in Apache 1.2 and is often included in the default Apache package provided by most Linux distributions.



Popular posts from this blog

How to apply for a new ration card and what are the documents required?

List of documents required for new ration card application in Kerala and how to apply


Application for a new ration card should be addressed to Taluk Supply Officer (TSO) / City Rationing Officer (CRO) of applicant's residing area.

Primary document required are Residence certificate, Income certificate and incase the applicant's name is in another ration card then he/she should submit the reduction certificate ontained from previous TSO / CRO as proof for removing his/her name from old Ration card.

You can get the new application from your currently residing Taluk Supply Office.

Payback Points - How to redeem - How to merge multiple payback accounts - Block Payback card - Payback customer care

Joomla and Forum Integration - Integrating Forums to Joomla

Joomla is one of the most popular CMS opensource packages. It is very easier to develop website's using Joomla. You just need to download Joomla package from Joomla's Official website www.joomla.org  and install it on your domain and later adding customizations to templates and feature and Your website is ready :). Now a days most websites provides a forum section for it users for discussing various article topics, gathering opinions etc.



Following are some best know forum opensource packages which can be integrated with Joomla and create a new forum experience for users


Urgent Openings for PHP trainees, Andriod / IOS developers and PHP developers in Kochi Trivandrum Calicut and Bangalore. Please Send Your updated resumes to recruit.vo@gmail.com   Read more »
Member
Search This Blog