This is as simple as copying the files to /opt/informix or using one of the various install methods provided. But beyond that it is necessarily to initialize the required environment variables. The simplest way to set the environment variables is to create an informix.sh profile script in /etc/profile.d - these scripts are executed by /etc/profile whenever a session is created [such as when a user logs in]. Additionally you'll need to set these same variables in /etc/sysconfig/httpd so that they are set in Apache's environment when started by the system start-up scripts.
$ (cat << EOFYOURINSTANCENAME needs to be defined in /opt/informix/etc/sqlhosts. Your method of installing the SDK may or may not have set that up for you.
) > /etc/profile.d/informix.sh
Text 1: Creating /etc/profile.d/informix.sh
The system library path must also be extended to include the directories containing the SDK's libraries.
$ ( cat << EOFIf the library path is not configured correctly applications, included httpd, will not be able to load the Informix libraries. At this point the library cache can be refreshed by executing the /sbin/ldconfig command. Once that has been performed either log out and back into the server, or just reboot the server, to verify that upon logging in you have the INFORMIXDIR, INFORMIXSERVER, and DBDATE variables in your enviroment.
) > /etc/ld.so.conf.d/informix.conf
Text 2: Extending the system's library path
Step#2 : Build the Informix PDO driver.
In order to build PHP PECL modules you must have php-devel, make, and gcc installed on the server.
$ pecl download PDO_INFORMIX-1.2.6If your Informix SDK is installed correctly and you've properly initialized the environment everything should be found automatically and build without complaint. Now move the PDO driver into place and inform the PHP interpreter that it needs to load the library. Here we perform a dirty trick of first loading the base pdo.so library. This shouldn't be necessary and PHP will grumble about it upon initialization, but it works around some wackiness regarding PDO versions. Without this line pdo_informix.so will refuse to load because PDO isn't loaded yet because the need for PDO isn't automatically discovered.
$ tar xzf PDO_INFORMIX-1.2.6.tgz
$ cd PDO_INFORMIX-1.2.6
Text 3: Building PDO_INFORMIX
$ cp /tmp/PDO_INFORMIX-1.2.6/modules/pdo_informix.so /usr/lib64/php/modules/Now we can try to start/restart the Apache service and see if our PDO module is available: service httpd restart. But it won't work. The loading of the Informix SDK by Apache will be blocked by SELinux's security policy.
$ ( cat << EOF
) > > /etc/php.d/informix.ini
Text 4: Install and register PDO_INFORMIX
Step#3 : Provision SELinux
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_informix.so' - libifcli.so: failed to map segment from shared object: Permission denied in Unknown on line 0The solution is not to disable SELinux; SELinux is your over-protective big brother. Maybe annoying to have around sometimes, but worth it for those time when you need to take a short cut through a dark musty alley. The correct solution is just to label the required library as a known and approved shared library.
The message in /var/log/httpd/error_log indicating that loading the library failed with a "permission denied"; regardless of what you set the permissions too.
Text 4: SELinux blocking the loading of libifcli.so
$ chcon -t lib_t /opt/informix/lib/cli/libifcli.soStep#3 : Get coffee
Text 5: Applying the appropriate label to libifcli.so
Restarting Apache know and you should see the pdo_informix driver available in phpinfo() output. Also double check that INFORMIXDIR, INFORMIXSERVER, and DBDATE appear in the "Enviroment" section of phpinfo; without these variables the PDO driver will not be able to find your informix instance.
From here on out it is pretty much the web developer's problem.