You are on page 1of 12

A step-by-step how-to guide to install, configure, an...

A step-by-step how-to guide to install, configure, and test a Linux, Apache, Informix, and PHP server
A cookbook for LAIP systems Kellen F. Bombardier (, Software Engineer, EMC Summary: Learn how to install, configure, and test a Linux®, Apache®, Informix®, and PHP (LAIP) server. LAIP provides a very powerful and dynamic mixture for a Web server. Date: 08 Jun 2006 Level: Intermediate Also available in: Russian Activity: 17478 views Comments: 2 (View | Add comment - Sign in) Average rating (33 votes) Rate this article Before you start

IBM DB2 e-kit for Database Professionals
Learn how easy it is to get trained and certified for DB2 for Linux, UNIX, and Windows with the IBM DB2 e-kit for Database Professionals. Register now, and expand your skills portfolio, or extend your DBMS vendor support to include DB2. This article assumes the use of an RPM-based 32-bit Linux system. The steps provided have been completed on Red Hat Enterprise Linux 4 and SUSE Linux 9. However, the overall ideas can be conveyed across any Linux distribution. Pre-installation steps First, you need to have the Informix Dynamic Server and the Informix Software Development Kit. If you do not have these products, you can find them on the Informix product family page. 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

1 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...
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

2. Get the components you need:
wget wget wget

The following versions of the LAIP products are used during this setup: PHP Apache HTTP server Informix Dynamic Server (IDS) Informix Client Software Development Kit (Client SDK) Informix PHP Data Objects (PDO) 5.1.2 2.2.0 10.00.UC4 2.90.UC4 1.0.0

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 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...

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

3. 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

4. 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):

or C shell (csh):
setenv INFORMIXDIR /opt/informix setenv PATH ${PATH}:${INFORMIXDIR}/bin

5. 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

6. 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

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. 7. Extract the Client SDK tar file into /opt/informix.

3 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...

mv client*.tar /opt/informix cd /opt/informix su informix tar -xvf client*.tar

8. 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 set set set set set INFORMIXDIR=/opt/informix INFORMIXSQLHOSTS=/opt/informix/etc/sqlhosts ONCONFIG=onconfig INFORMIXSERVER=myserver SERVERNUM=1 PATH=$INFORMIXDIR/bin:.:$PATH

or C shell (csh):
setenv setenv setenv setenv setenv setenv INFORMIXDIR /opt/informix INFORMIXSQLHOSTS /opt/informix/etc/sqlhosts ONCONFIG onconfig INFORMIXSERVER myserver SERVERNUM 1 PATH $INFORMIXDIR/bin:.:$PATH

2. 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

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

4 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...

3. 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:
DBSERVERNAME myserver DUMPDIR /tmp LOGDIR /opt/informix/logdir MSGPATH /opt/informix/logdir/online.log PHYSDBS rootdbs ROOTNAME rootdbs ROOTPATH /opt/informix/logdir/rootdbs ROOTSIZE 30000

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. 4. Add the above specified log directory and root space. For the setup in this example, the following was done:
su su cd su su su informix mkdir /opt/informix/logdir informix chmod 777 /opt/informix/logdir /opt/informix/logdir informix touch rootdbs informix chmod 660 rootdbs root chown informix.root rootdbs

5. Make sure everything works correctly. a. Try to bring up the server:
cd /opt/informix/bin oninit -i

b. Check to make sure it came up correctly by using the following command:
onstat -

c. 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

5 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...

For any issues with the Informix Dynamic Server, refer to the IBM Informix Dynamic Server v10.0 Information Center for troubleshooting help. 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 \ --enable-module=so make 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
#AddType application/x-httpd-php-source .phps


2. 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. 3. 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

2. 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 \

6 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...
--with-jpeg-dir=/usr/lib \ --with-zlib-dir=/usr/lib \ --with-zlib \ --without-pdo-sqlite \ --without-iconv \ --without-sqlite \ --enable-shared \ --enable-pdo \ --with-pdo-informix=/opt/informix make make install cp php.ini-dist /usr/local/lib/php.ini

3. You can now see if the PHP install went as planned. You can issue the following command:
php -m

4. 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. 5. 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 phpize ./configure make

6. 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:

7 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...

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

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. 2. 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):
<html> <body> <?php echo "PHP and Apache are playing nicely!"; ?> </body> </html>

Apache are playing nicely!.

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

3. 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

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:

Remember to do the following: a. Add users that need access to the 'informix'.sysauth table in the sysuser database. b. 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.

8 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...

4. 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):
<?php $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"; ?>

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. When you open the Web page of test.php you should see followed by the entity contents you added to your table. Congratulations! You have an LAIP system ready for use!
Connection Established!


Table Contents

Resources Learn Red Hat Enterprise Linux Documentation: Find information regarding Red Hat Enterprise Linux. Informix Dynamic Server page: Find information on IDS. IBM Informix Dynamic Server V10.0 Information Center: Get troubleshooting help for the IBM Informix Dynamic Server V10.0. SUSE Linux documentation: Find SUSE Linux information. Apache HTTP server documentation: Find Apache HTTP server information. PHP documentation: Find information on PHP. Visit the developerWorks Informix zone to expand your Informix skills.

9 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...

developerWorks Information Management zone: Learn more about DB2. Find technical documentation, how-to articles, education, downloads, product information, and more. Stay current with developerWorks technical events and webcasts. Get products and technologies Informix product family : Find out how to get Informix product downloads. PHP downloads: Get PHP downloads. Apache HTTP Server Project downloads: Get Apache HTTP Server Project downloads. Build your next development project with IBM trial software, available for download directly from developerWorks. Discuss Participate in developerWorks blogs and get involved in the developerWorks community. About the author

Kellen Bombardier is a software engineer for IBM and a developer on the Information Management team.

Close [x]

developerWorks: Sign in
If you do not have an IBM ID and password, register here. IBM ID: Forgot your IBM ID? Password: Forgot your password? Change your password? After sign in: Stay on the current page

By clicking Submit, you agree to the developerWorks terms of use.

10 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...



The first time you sign into developerWorks, a My developerWorks profile is created for you. This profile includes the first name, last name, and display name contained in the profile you created when you registered with My developerWorks. Selected information in your My developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post. All information submitted is secure. Close [x]

Choose your display name
The first time you sign in to developerWorks a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks. Display name: (Must be between 3 – 31 characters.)

Note: Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email for privacy reasons. By clicking Submit, you agree to the developerWorks terms of use.



All information submitted is secure. Average rating (33 votes) 1 star 2 stars 3 stars 4 stars 5 stars 1 star 2 stars 3 stars 4 stars 5 stars

Add comment: Sign in or register to leave a comment. Note: HTML elements are not supported within comments.

11 of 12

20/01/11 12:25

A step-by-step how-to guide to install, configure, an...

1000 characters left

Total comments (2) This is an excellent tutorial! To update it for 2010: I used php 5.3.3, apache 2.2.16, PDO 1.2.6 (just substitute these version numbers into the URLs provided in the article) Also, change references to "no-debug-non-zts-20050922" to "no-debug-non-zts-20090626" In apache startup environment file "/usr/local/apache/bin/envvars", add line to set INFORMIXDIR export INFORMIXDIR= . This will avoid getting a 23101 error from the test.php script. The other thing I had to do was Posted by mdwilkie on 28 September 2010 Report abuse sorry, I can't find "informix pdo Module". system environment: os: windows7 x64 http server: apache 2.2 --->ok php: version: 5.2.4, 5.2.5, 5.2........13, 5.3.x --->ok all of thos version of php, when I get a extension packet named "php_pdo_informix" from version 1.0.0 , and when I run command "php -i", it will display like this: PHP Warning: PHP Startup: pdo_informix: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=1 PHP compiled with module API=20060613, debug=0, thread-safety=1 These options need to match in Unknown on line 0 so, where I can get a usable php_pdo_informix for php 5.2.x or php 5.3.x ? I only to use a IBM open admin tool for informix. soo difficulty. I work at this test 2 days! Posted by jiangtao on 25 March 2010 Report abuse Trademarks | My developerWorks terms and conditions

12 of 12

20/01/11 12:25