Skip to main content

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

The first time you sign into developerWorks, a profile is created for you. Select information in your 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]

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.

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 address for privacy reasons.

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

All information submitted is secure.

  • Close [x]

A step-by-step how-to guide to install, configure, and test a Windows, Apache, Informix, and PHP server

A cookbook for WAIP systems

Kellen F. Bombardier (kfbombar@us.ibm.com), Software Engineer, IBM, Software Group
Photo: Kellen Bombardier
Kellen Bombardier is a software engineer for IBM and a developer on the Information Management team.

Summary:  Learn how to install, configure, and test a Windows®, Apache, Informix®, and PHP (WAIP) server. Windows, Apache, Informix, and PHP together form a very powerful and dynamic combination for a Web server.

Date:  27 Jul 2006
Level:  Introductory
Also available in:   Chinese

Activity:  15309 views
Comments:  

Before you start

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.

Pre-installation steps

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:

PHP5.1.2
Apache HTTP server2.2.2
IDS10.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.

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

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

  4. (This is the only step needed if using a remote IDS) Extract the Client SDK tar file:
    Unpack client*.tar to C:\src\csdk 
    		

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

  1. Open a command prompt (Start > Run > cmd).
  2. Go to your Informix installation directory (cd C:\Program Files\IBM\Informix).
  3. Go to the bin folder (cd bin).
  4. 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.

  1. Set up the connectivity from the Client SDK to the IDS:
    Run Setnet32: Start > All Programs > IBM Informix Client-SDK 2.90.
  2. Under the Environment tab, make sure the INFORMIXDIR and the INFORMIXSERVER variables are correct.
  3. Under the Server Information and the Host Information tab, make sure the fields match what you entered in the Server Instance Manager.
  4. Finally, you should create the Data Source Name (DSN) needed to connect to the Informix database:
    1. Run Data Sources: Start > Control Panel > Administrative Tools > Data Sources (ODBC).
    2. Go to the System DSN tab, and click Add.
    3. Scroll down and click the IBM INFORMIX 3.82 32 BIT driver.
    4. Fill all the tabs with the information from your IDS instance.
    5. 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.


Install Apache

If you are installing from a binary, go to the Install Apache from binary section. Otherwise, skip to the Compile Apache from source section.

Install Apache from binary

  1. 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.
  2. Follow all of the defaults in the installation unless you know that changing from the defaults will not harm your WAIP server setup.
  3. Installation completion should start the Apache server, and your Apache setup is complete.

You can now proceed to the Configure Apache section.

Compile Apache from source

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:

  1. Open up a command prompt (Start > Run > cmd).
  2. Go to the Apache source (enter the command cd C:\src\apache).
  3. 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:

  1. Open up a command prompt (Start > Run > cmd).
  2. Go to the Apache source (enter cd C:\src\apache).
  3. 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 (enter nmake /f Makefile.win installd INSTDIR="C:\www\apache").

Configure Apache

  1. 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).
  2. Change the php module directory (location depending on the installation location):
    LoadModule php5_module "C:/www/php5/php5apache2.dll"
    		

  3. Look for the following lines:
    #AddType application/x-httpd-php .php 
    #AddType application/x-httpd-php-source .phps 
    		

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


Install and configure PHP

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

  1. Extract the PHP files that you downloaded earlier from PHP.net. Extract the PHP files to C:\Program Files\PHP.
  2. Create a php.ini file:
    Copy C:\Program Files\PHP\php.ini-dist to C:\WINDOWS\php.ini
    		

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

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

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

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

  2. Extract the source of win32 and bindlib_w32:
    Extract win32build to C:\src\win32build 
    Extract bindlib_w32 to C:\src\bindlib_w32 
    		

  3. Then, you have to do the following:
    Copy C:\src\win32build\bin\bison.simple to C:\usr\local\lib\bison.simple
    		

  4. Build resolv.lib by doing the following:
    1. Go to bindlib_w32 directory (for example, "cd C:\src\bindlib_w32").
    2. Run the VCVARS32.BAT to set up the development variables (for example, "C:\Program Files\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT")
    3. 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"")
  5. 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
    		

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

  7. Configure and make PHP with PDO_INFORMIX:
    1. Open a command prompt (Start > Run > cmd).
    2. 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 
      

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

  9. 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"
    		

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

  11. Create a PHP directory and move the appropriate files over:
    1. Create a directory: C:\www\php.
    2. Copy php.exe and all .dlls from C:\src\php\Release_TS to C:\www\php.

Test the new dynamic Web server

  1. Start Apache, if it is not already running by performing the following steps:
    1. Open up a command prompt (Start > Run > cmd).
    2. Go to your Apache installation directory (cd C:\www\apache).
    3. Go to the bin folder (cd bin).
    4. Run the httpd.exe.
  2. 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.
  3. 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>
    		

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

    1. Open up a command prompt (Start > Run > cmd).
    2. Go to your Informix installation directory (cd C:\Program Files\IBM\Informix).
    3. Go to the bin folder (cd bin).
    4. Run dbaccess (dbaccess).
  6. Then perform the following steps:
    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.
    3. 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.
  7. 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! and Table Contents followed by the entity contents you added to your table.

Congratulations! You have a WAIP system ready for use.


Resources

Learn

Get products and technologies

Discuss

About the author

Photo: Kellen Bombardier

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

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

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

 


The first time you sign into developerWorks, a profile is created for you. Select information in your 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.

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.

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 address for privacy reasons.

(Must be between 3 – 31 characters.)

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

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management
ArticleID=150159
ArticleTitle=A step-by-step how-to guide to install, configure, and test a Windows, Apache, Informix, and PHP server
publish-date=07272006
author1-email=kfbombar@us.ibm.com
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers