Posts Tagged ‘Informix’

PHP – problem trying to connect with Informix on IIS

I was working on a project which needs PHP talk to Informix database on Windows platform. After installed IBM Informix Client_SDK, included PHP extension php_ifx.dll, and use following command to connect to Informix:

$sync_link_id = ifx_connect($database, $username, $password);

I got following error:

[SQLSTATE=IX 000 SQLCODE=-25560]

If you check Informix document from IBM, you know Environment variable INFORMIXSERVER must be set. We know how to set up environment variable on Unix and Apache, but the question is how to set it up for IIS?

People may first think this could be environment variable on Windows as well. But this is wrong. Informix client is using Registry KEY on Windows platform. Here is the path on a 64bit machine.

HKEY_LOCAL_MACHINE\Software\Wow6432Node\Informix\Environment\

Second, you should have your default server setup under KEY:

HKEY_LOCAL_MACHINE\Software\Wow6432Node\Informix\SqlHosts\

At here, you need to provide HOST, PROTOCOL and SERVICE, so php_ifx knows how to connect to your Informix server.

After set them up, PHP should be able to talk to Informix.