Skip to content
This repository has been archived by the owner on May 15, 2021. It is now read-only.

A working example of a docker container with PHP, Apache and PDO_Informix support.

Notifications You must be signed in to change notification settings

vctls/docker_php_pdo_informix

Repository files navigation

Docker PHP, Apache and PDO_Informix

Inspired by https://github.com/joanrivera/docker-informixpdo


DISCLAIMER: I'm archiving this repo as I never managed to make the PHP PDO driver work correctly 100% of the time. The handling of locales and character encoding with this DBMS is stupid. String to date conversions don't always support ISO format, diacritics are mangled, and when you fix the diacritics you end up with CHAR fields padded with garbage instead of whitespace.
On the other hand, the JDBC driver works just fine, so if you can use a “bridge” like this one instead of connecting directly from PHP, just use a JEE based service.
For example: https://github.com/vctls/jdbc-informix-bridge


Base configuration files to generate a Docker container with PHP, Apache and PDO_Informix support.

This is a proof of concept on how to compile and install PDO_Informix with the IBM Informix SDK.

It provides a very crude web API to which you can send SQL queries and retrieve the results in JSON format.

WARNING: Queries are executed literally. This provides no security whatsoever.

Setup

You can either pull the image from the Docker hub or build it yourself as follows.

  1. Clone the project.

  2. CSDK and the PDO souce code are versioned through Git LFS, but if for some reason you need to donwload them manually, backup links are below. Put both into the informix directory:

  3. (Optional) In the informix/slqhosts file, change the string demo_server to match your Informix server name.

  4. (Optional) Review the files in the scripts directory and edit according to your needs. Be sure to check the file names if you're not using the ones provided.

  5. Copy .env.dist into .env and set your connection settings in that file.

Since the IBM site is a real PITA, has changed multiple times, requires an account, and we have no guarantee that these files won't disappear overnight, here's a direct link to a working version:
https://mega.nz/#!RZ4SEa5I!TUxX4ZP75g3jqyX0vlCVIjD_L_W7Kj3tpilpKn4tcMc
And here's a link to the PDO_informix source, just in case:
https://mega.nz/#!ZQ5DGYjA!J7ppK75hFd9PxsJ5Fsoc8n9s3IDRvhKxKzGQ-z8ZmA8

Build...

  1. Build the image:
    docker build -t ifxpdo .

  2. When containers are to be created, note that you must set the Infomix server IP:
    docker run -d -p 80:80 -v /var/www/html:/var/www/html --add-host ifxserver:192.168.0.2 ifxpdo.

Or,

Run the project with docker-compose:
docker-compose up

Open localhost in your browser to see if it's working.

You should see something like this:

[{"":"2019-07-31 14:28:29.160","0":"2019-07-12 14:28:29.160"}]

Declare the informix.local domain for clarity.

You can pass SQL queries in get parameters as follows. The string must of course be URL encoded. Modern browsers will do that automatically.

http://informix.local/?query=SELECT * FROM systables WHERE tabid=:tabid&params[tabid]=1;

You can also pass the PDO fetch style through the fetch_style parameter.
Default is 2 (FETCH_ASSOC).

http://informix.local/?query=SELECT * FROM systables WHERE tabid=:tabid&params[tabid]=1&fetch_style=3;

About

A working example of a docker container with PHP, Apache and PDO_Informix support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published