Saturday, January 09, 2010

Set up a DB2 Windows Apache PHP stack

This is a really quick guide. Feel free to ask questions in the comments or on the DB2 Express-C forum.

  1. Install DB2 Express-C

  2. Install Apache HTTP Server 2.2.x

  3. Install PHP 5.3.x (VC6, thread-safe)

  4. Get the compiled IBM_DB2 extension (VC6, thread-safe, not nts)

  5. Copy the unzipped DLL to the extensions directory of your PHP installation. For example:

    C:\Program Files\PHP\ext

  6. Open the php.ini of your PHP installation. For example:

    C:\Program Files\PHP\php.ini

  7. Add these lines at the end:



  8. Restart your web server:

  9. Create a text file in your Apache htdocs folder. For example, in:

    C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

  10. Call it test.php and paste the following into it:


    echo phpinfo();


  11. Open http://localhost/test.php in your web browser

  12. If you see the following, your installation is ready for use:

Additional Resources


Leons Petrazickis
DB2 Express-C Community Team


  1. I can't find a 64-bit compiled php_ibm_db2.dll.

  2. @Kelvin: Is there a 64-bit release of PHP for Windows? Googling, all the Windows binaries of Apache and PHP that I'm seeing are 32-bit. Is this for IIS?

    If you are compiling from source, you can get the extension source here:

    You'll need the DB2 headers included in the IBM Data Server Driver for ODBC and CLI:

  3. Thank!!

    how I compile ibm_db2 for x64?
    do you have any tutorial?

    1. @Admin: It really depends on your Linux distribution. I would install pecl, try using pecl to install ibm_db2, and install any missing libraries as you go (libstdc++, libaio, etc).


Note: Only a member of this blog may post a comment.

Google Analytics Alternative