Adding Apache/Httpd environment variables for PHP/Web on RHEL/CentOS

This is related to PDO Informix.

I need to run CLI and web page at the same time. PDO Informix look for Informix SDK path (strangely); I think it is because it uses SDK libraries instead of importing all the functions in PDO itself.

Creating Apache Path info can be kind of tricky. This solution may work only for me, though.

#1. Add a path information for all users. It is for the PHP CLI. From web server, this is not visible.

$ cd /etc/profile.d
$ vi informix.sh
And add the following lines:
export INFORMIXDIR=”/opt/IBM/informix/4.10″
export PATH=$PATH:$INFORMIXDIR

#2. For Apache env variables, RHEL/CentOS provides /etc/sysconfig/httpd
$ vi httpd
And add the following line:
INFORMIXDIR=”/opt/IBM/informix/4.10″

Restart Apache server.

When I looked for the information, many people indicates that I need to export this value. I tried it but doesn’t work for me.
Also many resources point to SetEnv in httpd.conf. It shows the variables phpinfo() but it doesn’t actually work.

Installing PHP PDO Informix on RHEL/CentOS

When I install PHP, I realized I applied the following command.
$ yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

On a CentOS, Red Hat Enterprise Linux or Fedora machine and their derivitives, this is a simple as running this command, either using sudo or as the root user:
$ yum install php-pear
The pecl command can then be found at /usr/bin/pecl. On other Linux distributions it should be a similar process.

It doesn’t mean you’re not read to compile. Then again, here’s the issue.
$ yum install php-devel

1) download last version of PDO
$ mkdir pdo
$ cd pdo
$ wget http://pecl.php.net/get/PDO_INFORMIX-1.3.3.tgz

2) uncompress
$ tar zxf PDO_INFORMIX-1.3.3.tgz
$ cd PDO_INFORMIX-1.3.3/

3) set your INFORMIXDIR
$ export INFORMIXDIR=/opt/IBM/informix/4.10

3) execute phpize
$ phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions

3) execute the ./configure
$ ./configure
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking for grep that handles long lines and -e… /usr/bin/grep
checking for egrep… /usr/bin/grep -E
checking for a sed that does not truncate output… /usr/bin/sed
checking for gcc… gcc

Add a module file under
$ cd /etc/php.d
$ vi 30-pdo_informix.ini
(Prefix number is optional)
And add the line:
extension=pdo_informix.so

Restart Apache server.

Installing Informix Client SDK on RHEL/CentOS

As for Informix user, you have to jump through a lot of hoops since it has become a dinosaur and due to the lack of support from IBM.

I prefer PHP to Perl in writing a shell program and connecting Informix was full of wonder. I still don’t understand why IBM keeps insisting that a simple Informix db library has to look for SDK. It is just heart-wrenching but it is what it is, I guess.

First off, installing Informix client sdk itself turned out to be pretty daunting task. Nothing is out of box but I wasn’t prepared enough.

Downloading Informix Client SDK from IBM website (it’s not easy to navigate to find what you need — this is another challenge).

Here’s the issues I faced:
Exception “JRE libraries are missing or not compatible” occurs while installing Content Platform Engine 5.2.1 on Linux

Preparing to install…
Extracting the JRE from the installer archive…
Unpacking the JRE…
Extracting the installation resources from the installer archive…
Configuring the installer for this system’s environment…
Launching installer…
JRE libraries are missing or not compatible….
Exiting….

It is casued by ld-linux.so.2 library is missing on Linux.
To resolve The Problem, install it with following command:
$ yum install ld-linux.so.2

And another cause is insufficient permissions in the /tmp directory. In environments where obtaining the required permissions may not be straightforward due to how the server is locked down, security policies, etc., there is a simple workaround. You need to create a new “temp” directory in a location where you do have the proper permissions.

Example:
$ mkdir /opt/informix/tmp
$ export IATEMPDIR=/opt/informix/tmp

(You have to apply this command if you terminate the session).

Thanks to this link: https://www.coreblox.com/blog/2018/2/ca-access-gateway-install-error-jre-libraries-are-missing-or-not-compatible

I faced additional issue with another server:

“One or more prerequisite system libraries are not installed on your computer.
Install libncurses.so.5 and then restart the IBM Informix installation
program.”

In this case, you need to install
$ yum install libncurses*