This document takes you through the steps needed to install, configure, and test a "WAIP" system. WAIP stands for Windows, Apache, Informix, and PHP. It is hoped that these steps help to ease the installation and setup of a very powerful and dynamic Web system.
This article assumes the use of Windows XP Pro (32 bit). The steps provided have been completed only on XP Pro, but could very likely be transferred to other versions of Windows.
First, you need to have the Informix Dynamic Server (IDS) and the Informix Software Development Kit. If you do not have these products, see the Resources section for links to trial downloads.
Next, you should remove any of the components that we will be installing for the WAIP server. In order to remove these components, you must first be the administrator on the computer you are working on.
Look for the following packages that could be currently installed on your system:
- Apache or Apache2
- PHP or PHP5
- Informix or the Informix Client SDK
You can then remove all of the packages found by selecting Start > Control Panel > Add/Remove Programs. Then remove any programs listed above.
You should now have a "clean" Windows environment ready for component installation and setup.
Binary installation or compile from source
The first major decision in setting up your WAIP server is to choose whether you would like to compile all of the components from source, or to gather the binaries and run the appropriate installations. Most sections, besides the Informix and Informix Client SDK sections, have a binary and a source section. Please use the appropriate section.
Gather and install all the needed applications
You first need to gather all of the applications from the Web. Open your favorite browser and download the applications needed. If you are using binaries, gather the following:
http://apache.osuosl.org/httpd/binaries/win32/apache_2.2.2-win32-x86-no_ssl.msi http://www.php.net/distributions/php-5.1.2-Win32.zip http://pecl4win.php.net/download.php/ext/5_1/5.1.2/php_pdo.dll http://pecl4win.php.net/download.php/ext/5_1/5.1.2/php_pdo_informix.dll |
If you are compiling from the source, gather the following:
http://mirrors.isc.org/pub/apache/httpd/httpd-2.2.2-win32-src-rev2.zip http://www.php.net/distributions/php-5.1.2.tar.gz http://www.pecl.php.net/get/PDO_INFORMIX-1.0.0.tgz |
The following versions of the WAIP products are used during this setup:
| PHP | 5.1.2 |
| Apache HTTP server | 2.2.2 |
| IDS | 10.00.UC4 |
| Informix Client Software Development Kit (Client SDK) | 2.90.UC4 |
| Informix PHP Data Objects (PDO) | 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 (complete only if you are using the source code setup)
You need a utility to unpack all of the source code (using, for example, WinZip). Then unpack all of the source code into C:\src (apache, php, pdo_informix).
Unpack httpd-2.2.0-win32-src-rev2.zip into C:\src\apache Unpack php-5.1.2.tar.gz into C:\src\php Unpack PDO_INFORMIX-1.0.0.tgz into C:\src\pdo_informix |
Install Informix and Client SDK
If you already have the IDS installed on a remote machine, then you only need to install the Client SDK. You can skip the following steps for installing and configuring IDS.
- Check to see if any patches are needed for your operating system. Refer to the Informix product family page to see if any patches are needed.
- Extract the Informix files with the given Informix
tar file. If the tar file of the Informix server is in the current
directory, you can extracting the files as follows (if the file is something
like IIF*.tar):
Unpack IIF*.tar to C:\src\informix
-
Go to the extracted files and run the installation of
the IDS. After running the setup, simply follow the
on-screen instructions to complete the installation of Informix. Be sure to take
all of the defaults unless you have a specific need that you know won't
harm the setup of the WAIP server.
Run the setup of IDS from C:\src\informix.
-
(This is the only step needed if using a remote IDS) Extract
the Client SDK tar file:
Unpack client*.tar to C:\src\csdk
-
Run the setup to install the Client SDK. After
running the setup, simply follow the on-screen instructions to complete the
installation of the Client SDK portion of Informix:
Run the setup of the Client SDK from C:\src\csdk
Configure Informix and the Informix Client SDK
Most of the configuration of the IDS was done through the installation. However, in order to check that this was done correctly, you should create a server instance and try to initialize it.
To create a server instance, you can go to the Server Instance Manager:
Start > All Programs > IBM Informix Dynamic Server 10 > Server Instance Manager
Simply follow the steps in the Server Instance Manager to create a new instance. However, you need to remember the values you entered when you setup the Client SDK. At the end of setup, say "Yes" to initializing the new instance. If it initializes correctly then all is well.
Check to make sure the server instance is up and running by doing the following:
- Open a command prompt (Start > Run > cmd).
- Go to your Informix installation directory (cd C:\Program Files\IBM\Informix).
- Go to the bin folder (cd bin).
- Run the onstat to check if the server instance is up and online (onstat -).
If you see the following:
shared memory not initialized for INFORMIXSERVER
'servername', then the setup did not work correctly. But if you see the following:
IBM Informix Dynamic Server Version 10.00.TC4 -- On-Line -- Up 00:00:07 -- 19508 Kbytes
then everything is up and working.
For any issues with the IDS, go to the Informix Information Center for troubleshooting help.
Now you are ready to configure the Client SDK.
- Set up the connectivity
from the Client SDK to the IDS:
Run Setnet32: Start > All Programs > IBM Informix Client-SDK 2.90. - Under the Environment tab, make sure the INFORMIXDIR and the INFORMIXSERVER variables are correct.
- Under the Server Information and the Host Information tab, make sure the fields match what you entered in the Server Instance Manager.
- Finally, you should create the Data Source Name (DSN) needed to connect to the Informix database:
- Run Data Sources: Start > Control Panel > Administrative Tools > Data Sources (ODBC).
- Go to the System DSN tab, and click Add.
- Scroll down and click the IBM INFORMIX 3.82 32 BIT driver.
- Fill all the tabs with the information from your IDS instance.
- Be sure to check Use Server Database Locale under the Environment tab.
With the above DSN creation, you have a suitable way to connect to your Informix database. Remember the DSN name so that you can later use it in your PHP scripts.
If you are installing from a binary, go to the Install Apache from binary section. Otherwise, skip to the Compile Apache from source section.
- The first step to install Apache from binaries is to double-click the installer that you downloaded earlier from Apache.org: Run the Apache installer.
- Follow all of the defaults in the installation unless you know that changing from the defaults will not harm your WAIP server setup.
- Installation completion should start the Apache server, and your Apache setup is complete.
You can now proceed to the Configure Apache section.
Apache has a great site explaining how to do this. Go to the Compiling Apache for Microsoft Windows site for complete details. The important parts of those steps are highlight here.
All of the compilation used in for this article was done using Visual C++ 6. You also need the Platform SDK from Microsoft. The latest Platform SDK that I would recommend using is the February 2003 edition. You also need to download awk.exe and make sure it is in your PATH. You must make sure to name the awk file awk.exe in case you download awk95.exe or some other derivative.
You should do the following to compile Apache:
- Open up a command prompt (Start > Run > cmd).
- Go to the Apache source (enter the command
cd C:\src\apache). - Run the nmake for the release build (enter
nmake /f Makefile.win _apacher), or
Run the nmake for the debug build (nmake /f Makefile.win _apached).
You need to install Apache after the compilation succeeds:
- Open up a command prompt (Start > Run > cmd).
- Go to the Apache source (enter
cd C:\src\apache). - Run the nmake to install the release build. (Enter
nmake /f Makefile.win installr INSTDIR="C:\www\apache")
or
Run the nmake to install the debug build (enternmake /f Makefile.win installd INSTDIR="C:\www\apache").
- Edit the http.conf file to process .php files correctly. The httpd.conf file can be found in C:\www\apache\conf\httpd.conf or C:\Program Files\Apache Software Foundation\conf\httpd.conf (depending on which installation option you chose).
- Change the php module directory
(location depending on the installation location):
LoadModule php5_module "C:/www/php5/php5apache2.dll"
- Look for the following lines:
#AddType application/x-httpd-php .php #AddType application/x-httpd-php-source .phps
- 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.
You can more fully configure your Apache server by editing the httpd.conf file. There is a great deal of documentation on the Internet about this topic.
If you are installing from a binary, then proceed to Install and Configure PHP from binary. Otherwise, skip to Compile, install, and configure PHP from source.
Install and configure PHP from binary
- Extract the PHP files that you downloaded earlier from PHP.net. Extract the PHP files to C:\Program Files\PHP.
- Create a php.ini file:
Copy C:\Program Files\PHP\php.ini-dist to C:\WINDOWS\php.ini
- The final step in the configuration of PHP is to add the correct
extensions to the php.ini file. The loadable extensions directory
is specified inside the php.ini file. It is most commonly found after
this line: ; Directory in which the loadable extensions (modules)
reside. The entry used for this article looks like the following:
; Directory in which the loadable extensions (modules) reside. extension_dir = "C:\Program Files\PHP\ext"
- The other change needed in the php.ini file is the definition of
the PDO and PDO_INFORMIX extension. This is found in the Dynamic
Extensions section in php.ini. All you should have to add is the following:
extension=php_pdo.dll extension=php_pdo_informix.dll
- Copy the php_pdo.dll and php_pdo_informix.dll files that
were downloaded earlier to C:\Program Files\PHP\ext:
Copy php_pdo.dll to C:\Program Files\PHP\ext\ Copy php_pdo_informix.dll to C:\Program Files\PHP\ext\
Installation completion should finish and your PHP setup is complete. You can now proceed to the Test the new dynamic Web server section.
Compile, install, and configure PHP from source
PHP has a great site explaining how to do this. For more information, refer to "PHP: Building from source" (php.net, June 2006). The important parts of those steps are highlighted here.
- Copy the PDO_INFORMIX folder from C:\src\PDO_INFOMRIX into the ext directory of PHP:
Copy C:\src\pdo_informix\PDO_INFORMIX-1.0.0 to C:\src\php\ext\PDO_INFORMIX
There are a few requirements needed before you can compile PHP. You need the following:
- win32 build tools.
- bindlib_w32 to replace resolv.lib.
- Extract the source of win32 and bindlib_w32:
Extract win32build to C:\src\win32build Extract bindlib_w32 to C:\src\bindlib_w32
- Then, you have to do the following:
Copy C:\src\win32build\bin\bison.simple to C:\usr\local\lib\bison.simple
- Build resolv.lib by doing the following:
- Go to bindlib_w32 directory (for example, "cd C:\src\bindlib_w32").
- Run the VCVARS32.BAT to set up the development variables (for example, "C:\Program Files\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT")
- Run the msdev to build the release build (for example, "msdev bindlib.dsp /MAKE "bindlib - Win32 Release""), or Run the msdev to build the debug build (for example, "msdev bindlib.dsp /MAKE "bindlib - Win32 Debug"")
- Copy the new resolv.lib to the appropriate location:
Copy C:\src\bindlib_w32\Release\resolv.lib to C:\src\win32build\lib\resolv.lib Accept the overwriting of the old resolv.lib
- Before compiling PHP, you might have to rename
a few files so that the compilation works correctly. This could vary
on different environments so adjust for the system you are working on:
Rename C:\src\apache\lib\libapr-1.lib to C:\src\apache\lib\libapr.lib Rename C:\src\apache\lib\libaprutil-1.li to C:\src\apache\lib\libaprutil.lib
- Configure and make PHP with PDO_INFORMIX:
- Open a command prompt (Start > Run > cmd).
- Enter the following commands:
cd C:\src\php buildconf cscript /nologo configure.js --disable-debug --disable-cgi --enable-apache2handler --disable-ftp --disable-mbstring --with-xml --enable-zlib --without-libxml --without-pdo-sqlite --without-iconv --without-sqlite --enable-pdo=shared --without-gd --with-pdo-informix="C:\Program Files\Informix\Client-SDK",shared --with-extra-includes="C:\www\apache\include" --with-extra-libs="C:\www\apache\lib" nmake
- You can now see if the PHP installation went as planned. Enter the following command:
php -m
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, and make install did not go as planned.
- The final step in the configuration of PHP is to add the correct
extensions to the php.ini file. It is found at C:\src\php\php.ini.
The loadable extensions directory is specified inside the php.ini
file. It is most commonly found after this line:
; Directory in which the loadable extensions (modules) reside. The entry used for the example in this article looks like the following:; Directory in which the loadable extensions (modules) reside. extension_dir = "C:\www\php\ext"
- The other change needed in the php.ini file is the definition of
the PDO extension. This is found in the Dynamic Extensions section
in php.ini. All you should have to add is the following:
extension=php_pdo.dll extension=php_pdo_informix.dll
- Create a PHP directory and move the appropriate files over:
- Create a directory: C:\www\php.
- Copy php.exe and all .dlls from C:\src\php\Release_TS to C:\www\php.
Test the new dynamic Web server
- Start Apache, if it is not already running by performing the following steps:
- Open up a command prompt (Start > Run > cmd).
- Go to your Apache installation directory (cd C:\www\apache).
- Go to the bin folder (cd bin).
- Run the httpd.exe.
- 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.
- 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. For the example used in this article, the location is C:\www\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>
- 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. - Make sure Informix is running (if the Informix server is
running on a separate remote server, then you can skip this check) and there is information you can query. To check to see if Informix is running, open up the Task Manager (press Cntrl-Alt-Delete and click the Processes tab) and look for the oninit process.
If any oninit 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 and tables, and insert or delete data. You can run dbaccess by doing the following (if Informix is installed locally):
- Open up a command prompt (Start > Run > cmd).
- Go to your Informix installation directory (cd C:\Program Files\IBM\Informix).
- Go to the bin folder (cd bin).
- Run dbaccess (dbaccess).
- Then perform the following steps:
- Add users that need access to the 'informix'.sysauth table in the sysuser database.
- Add a new database and table with data in it to test your server's setup.
- Match the database locale information with the database created in dbaccess with the locale in Setnet32. There is documentation on the Internet if you are not familiar with dbaccess.
- Check to make sure your PHP and PDO_INFORMIX setup
is working correctly. You should go to your default Apache document location (C:\www\apache\htdocs) to add a test.php file and to add additional
files needed there. The following is the contents of the test.php file used for this article (explained below):
<?php
$db = new PDO("informix:DSN=myDSN", "user", "pass");
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 the 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 DSN name is the name that you specified when creating the DSN.
When you open the Web page test.php you should see
Connection Established!andTable Contentsfollowed by the entity contents you added to your table.
Congratulations! You have a WAIP system ready for use.
Learn
- "PHP: Building from source" (php.net, June 2006): Learn how to compile PHP from sources on windows, using Microsoft's tools.
-
Informix Dynamic Server page:
Find information on IDS.
-
Informix Dynamic Server v10.0 Information Center: Get troubleshooting help for the IBM IDS V10.0.
-
Apache HTTP server documentation:
Find Apache HTTP server information.
-
PHP documentation: Find information on PHP.
-
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
-
Download a free trial version of Informix Dynamic Server.
-
Informix product family: Find out how to get the Informix Software Developer Kit and more Informix product downloads.
-
Build your next development project with
IBM
trial software, available for download directly from developerWorks.
-
PHP downloads:
Get PHP downloads.
-
Apache HTTP server project: Get Apache HTTP Server Project downloads.
Discuss
-
Participate in developerWorks blogs and get involved in the developerWorks community.
Comments (Undergoing maintenance)






