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 delete videos from your Youtube Watch History list?

How to Delete Individual or all videos from your Youtube Watch History list? Youtube keeps a fine record of the videos that you had watched earlier. You can view this by visiting the History section. If you want to remove the video's from the list do the following: Logon to Youtube and click on the "History" tab on the left menu to view Watch History ( Read more ) There will be check boxes corresponding to each video in the list Tick the check boxes of the videos which you want to remove Click on " Remove " button to delete the videos.

How to add "Link to this page" option under blogger posts?

Steps in adding Link to this page to your blogger posts Links to your page can improve your page rank. So it is a good option to add HTML code for linking to your web page. So that reader can copy and paste it on their web page. if another website links to your web page, this is considered an external link to your website. External links to your website are the most important source of ranking power and in SEO terminology it is considered as third party ranking vote for your page.

Intex Aqua 5.5 VR Plus genuine Review - Dont Buy Intex Aqua 5.5 VR Plus - Board complaint and low battery backup issues

Intex Aqua 5.5 VR Plus  Review - Dont Buy Intex Aqua 5.5 VR + - Board complaint and low battery backup issues I bought an Intex Aqua 5.5 VR Plus on April 23, 2018, With in a week it started to show Battery backup issues. Even if it is charged full, it will completely drain out with in 12 or 13 hours. During this time No internet was used, only 2 or 3 calls were done. Some times there was issues with net connection also.


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