Archive for July, 2008

Configure Informix with Apache and Php in Linux

Most Linux distributions come with some or all of the LAIP components pre-installed. They are generally not installed from the source, and therefore may not have the correct extensions compiled in. In order to remove these components, and not fall into RPM trouble, you must first be logged in as root:

su - root     

You can then look for all of the packages that are currently installed on your system:

rpm -qa | grep -i apache
rpm -qa | grep -i httpd
rpm -qa | grep -i php 

You can then remove all of the packages found in the above commands:

rpm -e filename       


You should now have a “clean” Linux distribution ready for component installation and setup. Fetch and unpack the source code for all applications

  1. Move to a location to store all of your source code:
cd /usr/local/src

Get the components you need:


The following versions of the LAIP products are used during this setup:



Apache HTTP server


Informix Dynamic Server (IDS)


Informix Client Software Development Kit (Client SDK)


Informix PHP Data Objects (PDO)


A different version of the above products may require a different set of steps for the setup to work properly. The steps given are unique to the products above. However, the general ideas can be followed across versions.

Unpack all the source code

tar zxf httpd-2.2.0.tar.gz
tar zxf php-5.1.2.tar.gz
tar zxf PDO_INFORMIX-1.0.0.tgz

Install Informix and Client SDK

To install Informix onto your Linux environment, perform the following steps:

  1. Check if any patches are needed for your operating system. You can go to the Informix Dynamic Server page to see if any patches are needed.
  2. Create the Informix user and group. The Informix user acts as the root account for the Informix database. Keep this account highly secured. Creation can be done as follows (where xxxx is the password for the user Informix):
groupadd informix
useradd -g informix -p xxxx -d /dev/null informix
  1. Create the installation directory. The default location is /opt/informix. Also, the last two commands are to ensure that the directory is owned by the Informix user and group:
su informix mkdir /opt/informix
chown informix.informix /opt/informix
chown informix.informix /opt/informix
  1. Set up all the environment variables needed. The INFORMIXDIR should be the location you used to install Informix. Using the default is done as follows:

Bourne Again shell (bash):

export PATH 

orC shell (csh):

setenv INFORMIXDIR /opt/informix
setenv PATH ${PATH}:${INFORMIXDIR}/bin
  1. Extract the Informix files with the given Informix tar file. If the tar file of the Informix Server and Client SDK are in the current directory, extracting the files is done as so (if the file is something like IIF*.tar):
mv IIF*.tar /opt/informix
cd /opt/informix
su informix tar -xvf IIF*.tar 
  1. Go to the extracted files and run the installation of the IDS. There are three methods of installing IDS. The default is the console method. There is also the graphical and silent method. You can choose whatever suits your needs. The console method is used in this example. The console method can be run as follows:
./install_rpm -acceptlicense=yes 

7.      After running the script, simply follow the on-screen instructions to complete the installation of Informix. Be sure to use the /opt/informix as the installation directory. The accept license flag should only be added if you accept the Informix license.

  1. Extract the Client SDK tar file into /opt/informix.
mv client*.tar /opt/informix
cd /opt/informix
su informix tar -xvf client*.tar
  1. Run the installation script to install the Client SDK. After running the script, simply follow the on-screen instructions to complete the installation of the Client SDK portion of Informix:

Configure Informix and the Informix Client SDK

  1. Create environment files needed to bring the Informix server up and running. An .informix file is created in the home directory with the following contents:

Bourne Again shell (bash):

set INFORMIXDIR=/opt/informix
set INFORMIXSQLHOSTS=/opt/informix/etc/sqlhosts
set ONCONFIG=onconfig

or C shell (csh):

setenv INFORMIXDIR /opt/informix
setenv INFORMIXSQLHOSTS /opt/informix/etc/sqlhosts
setenv ONCONFIG onconfig
setenv INFORMIXSERVER myserver
setenv SERVERNUM 1
  1. Add your server to the sqlhosts file. The sqlhosts file is found in /opt/informix/etc. You must add the INFORMIXSERVER name given above in the environment variables to the sqlhosts file. The added line in sqlhosts should follow this format:

dbservername nettype hostname servicename [options] Here is what was added:

myserver onsoctcp myserver port_alias

The port given must also be open on your system. In this example, it was opened in the /etc/services file. Here is an example of the line added to the services file:

port_alias 8201/tcp
  1. Create the onconfig file. The onconfig file must be in the /opt/informix/etc directory. There should already be a standard onconfig file there named onconfig.std. The contents below fit the system needs for this example. You may need to add extra variables or you may not need all of the variables shown below. The onconfig file contains the following contents:
LOGDIR /opt/informix/logdir
MSGPATH /opt/informix/logdir/online.log
PHYSDBS rootdbs
ROOTNAME rootdbs
ROOTPATH /opt/informix/logdir/rootdbs

4.      The DBSERVERNAME refers to the unique name associated with this specific database server instance. The DUMPDIR refers to the directory in which the server dumps shared memory and messages. The LOGDIR is the log directory for the IDS instance. The MSGPATH is the full path name of the message log file. The PHYSDBS is the name of the dbspce that contains the physical log. The ROOTNAME is the name for the root dbspace. The ROOTPATH is the full path name of the initial chunk of the root dbspace. The ROOTSIZE is the size of the initial chunk of the root dbspace.

  1. Add the above specified log directory and root space. For the setup in this example, the following was done:
su informix mkdir /opt/informix/logdir
su informix chmod 777 /opt/informix/logdir
cd /opt/informix/logdir
su informix touch rootdbs
su informix chmod 660 rootdbs
su root chown informix.root rootdbs
  1. Make sure everything works correctly.
    1. Try to bring up the server:
cd /opt/informix/bin
oninit -i
    2. Check to make sure it came up correctly by using the following command:
onstat -
    2. If you see "shared memory not initialized for INFORMIXSERVER 'myserver'", then the setup did not work. However, if you see the something similar to "IBM Informix Dynamic Server Version 10.00.UC4 -- On-Line -- Up 00:00:07 -- 19508 Kbytes", then everything is up and working.

If you would later like to bring the server down, then the following command can be issued:

onmode -kuy

Install and configure Apache

Follow the steps below to install Apache with support for dynamically loaded modules:

cd /usr/local/src/httpd-2.2.0/
./configure \
--prefix=/usr/local/apache \
--enable-shared=max \
--enable-module=rewrite \
make install 


  1. Edit the http.conf file to process .php files correctly. The httpd.conf file can be found in /usr/local/apache/conf/httpd.conf. Look for the following lines:

#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps

  1. Remove the #s from the beginning of these lines if they are found. If they are not in the file, then add them without the #s. This enables Apache to process and display php files correctly.
  2. You can more fully configure your Apache server by editing the httpd.conf file in /usr/local/apache/conf. There is a great deal of documentation on the Internet about this topic.

Install and configure PHP

Follow the steps below to install PHP:

  1. Copy the PDO_INFORMIX folder into the ext directory of PHP:
cd /usr/local/src/php-5.1.2/ext
cp -R ../../PDO_INFORMIX-1.0.0 pdo_informix
  1. Configure and make PHP with the PDO:
cd /usr/local/src/php-5.1.2
./buildconf --force
./configure --with-apxs2=/usr/local/apache/bin/apxs \
--disable-debug \
--disable-ftp \
--disable-inline-optimization \
--disable-magic-quotes \
--disable-mbstring \
--enable-wddx=shared \
--enable-xml \
--with-dom \
--with-regex=system \
--with-xml \
--with-jpeg-dir=/usr/lib \
--with-zlib-dir=/usr/lib \
--with-zlib \
--without-pdo-sqlite \
--without-iconv \
--without-sqlite \
--enable-shared \
--enable-pdo \
make install
cp php.ini-dist /usr/local/lib/php.ini
  1. You can now see if the PHP install went as planned. You can issue the following command:
php -m
  1. The output from this command should include both the PDO and the pdo_informix modules. If those are not included, then the buildconf, configure, make, or the make install commands did not go as planned.

There is the option to configure pdo_informix at a different time than PHP itself.

  1. You can compile pdo_informix by itself, but it requires phpize from the installation location of PHP. You do not need to perform this step if you configured or compiled pdo_informix while configuring or compiling PHP.
cd pdo_informix
  1. Add the correct extensions to the php.ini file. It is found at /usr/local/lib/php.ini. The loadable extensions directory is specified inside the php.ini file. It is most commonly found after the line:

; Directory in which the loadable extensions (modules) reside.

The entry used in this example looks like the following:

; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20050922/"

The other change needed in the php.ini file is the definition of the PDO and pdo_informix extensions. They are found in the Dynamic Extensions section in php.ini. If they were created as shared modules, you need to copy the modules into the above extension directory and enable them in the php.ini file as shown below:

Test the New Dynamic Web server

To test the New Dynamic Web server, complete the following steps:

  1. Start Apache. All you need to do is the following (again as root):
/usr/local/apache/bin/apachectl start

3.      Open up your favorite browser and type localhost into the address bar. The default Apache start page should show. This confirms that Apache has been started.

  1. Make sure that PHP is working with Apache. You need to edit the index.html file that is being displayed in your browser. This corresponds to where you installed Apache. The location used for this example is here: /usr/local/apache/htdocs/index.html.

Erase the index.html file and replace it with the following (named index.php):

echo "PHP and Apache are playing nicely!";

Then when you open up the page modified (http://localhost/index.php), you should see PHP and Apache are playing nicely!. If you see the PHP code itself , then your PHP and Apache installation or configuration is flawed.

  1. Make sure Informix is running and there is information you can query. In order to see if Informix is running, do the following:
ps -aef | grep oninit

6.      If any processes are found, then Informix is running. If not, start Informix with the command given above. The tool Informix uses is dbaccess to create or delete databases, create or delete tables, and insert or delete data. You can run dbaccess from:


7.      Remember to do the following:

    1. Add users that need access to the ‘informix’.sysauth table in the sysuser database.
    2. Add a new database and table with data in it to test your server’s setup.

There is documentation on the Internet if you are not familiar with dbaccess.

  1. Check to make sure your PHP and PDO Informix setup is working correctly. You should go to your default Apache document location (/usr/local/apache/htdocs) to add a test.php file. The following is the contents of the test.php file (explained below):
$db = new PDO("; service=8201;
database=test_db; server=testserver; protocol=onsoctcp;
EnableScrollableCursors=1;", "testuser", "testpass");
print "Connection Established!\n\n";
$stmt = $db->query("select * from test_table");
$res = $stmt->fetch( PDO::FETCH_BOTH );
$rows = $res[0];
echo "Table contents: $rows.\n";

9.      The variables in the connection string fit our system’s needs. Choose the variables and their values to fit your system and environment. The first line is the connection string for the Informix database. The informix: is needed to start the connection string. The host is simply the server host name. The service is the port number opened for your database (/etc/services). The database is the name of the database you created above. The server is the name of the database instance you created earlier. The protocol type is the protocol you entered in the /etc/sqlhosts file. The rest of the options are self explanatory. The last two options to the PDO object is the username and the password. Be sure that the user has been added to the sysuser database as explained above.

10.  When you open the Web page of test.php you should see Connection Established! and Table Contents followed by the entity contents you added to your table.


IBM Informix Server Administrator (ISA)

IBM Informix Server Administrator (ISA) is a browser-based, cross-platform database server administration tool. ISA provides an easy-to-use interface for the IBM Informix Dynamic Server command line, thus eliminating the need to memorize commands and options

ISA allows you to perform the following tasks from any machine with a web browser:

  • System Configuration
  • Backup and Restore
  • System Monitoring

How to install informix Client SDK or Iconnect(console/GUI modes) in Linux/Unix

To install Client SDK or IBM Informix Connect in console mode:
 1. As root, execute the command for the product

./installclientsdk or ./installconn The installation program begins in console mode.

 2. Enter 1 to continue the installation procedure. The Software License Agreement appears.

 3. Read the license agreement and accept the terms; then enter 1 to continue the installation procedure.

 4. Accept the default directory, or choose a different directory and enter 1 to continue.

 5. Choose Typical for the suggested setups or choose Custom for more configuration options.

6. Enter 1 to continue the installation procedure. The screen will show summary information including directory, components installed, and total size.

7. When the installation is complete, enter 3 to finish and exit the wizard.


To install the Client SDK or IConnect in GUI mode:

1. As root, execute the command with for the product
 installclientsdk -gui or installconn -gui

Issuing either of these commands will launch the installation program in GUI mode.

 2. Click Next to progress through the screens.

 3. Read the license agreement and accept the terms; then click Next to continue.

 4. When prompted, accept the default directory or specify a different directory.

 5. Check the items you want to select. 6. Click Next to continue installing.
You can find information that will help identify and resolve installation errors in two different types of log files

Installation-related log files: – For successful installations: – CSDK: $INFORMIXDIR/tmp/csdk-version-install.log

 IConnect: $INFORMIXDIR/tmp/iconnect-version-install.log

 For unsuccessful installations: – CSDK: tempdir/informix/csdk-version-install.log

 IConnect: tempdir/informix/iconnect-version-install.logv Product log files: – CSDK: $INFORMIXDIR/tmp/csdklog.txt – IConnect: $INFORMIXDIR/tmp/connlog.txt