IBM Support

-11041 trying to connect with PDO_INFORMIX php driver

Troubleshooting


Problem

-11041 error "Unspecified System Error" when trying to connect to IBM Informix database using the PDO_INFORMIX php driver.

Symptom

SQLSTATE=HY000, SQLDriverConnect: -11041 [Informix][Informix ODBC Driver][Informix]Unspecified System Error = -11041

Cause

The reason the error occurs is that the IBM Informix Client SDK environment variables are not set properly within the profile for user "root". The Apache Web Server is started by user "root" therefore the proper environment variables need to be set in the respective user's profile.

Environment

Unix

Diagnosing The Problem

To diagnose the problem, one can simply use either truss or strace to see what the Apache process is doing. For example, using strace on Linux:

1) Stop Apache.

2) Start Apache as root with strace like this:

[root@dns1 root]# strace -f -o /tmp/trace.txt /etc/apache2/bin/apache2ctl start

3) Run the php program within the browser until it errors.

Within the trace.txt output, you will see a line similar to this:

11689 open("/root/.odbc.ini", O_RDONLY|O_LARGEFILE) = -1 EACCES (Permission denied)

Resolving The Problem

Add the appropriate environment variables for IBM Informix Client SDK to the profile for user "root" and then restart the Apache Web Server. For example, you could add the following to /root/.bashrc on Linux:

#Adding environment variables
INFORMIXDIR=/opt/IBM/informix/
export INFORMIXDIR
INFORMIXSQLHOSTS=/opt/IBM/informix/etc/sqlhosts
export INFORMIXSQLHOSTS
INFORMIXSERVER=smokehp_tcp
export INFORMIXSERVER
ODBCINI=/opt/IBM/informix/etc/odbc.ini
export ODBCINI
LD_LIBRARY_PATH=/opt/IBM/informix/lib:/opt/IBM/informix/lib/esql:/opt/IBM/informix/lib/cli:/opt/IBM/informix/lib/c++:/opt/IBM/informix/lib/client:/opt/IBM/informix/lib/dmi
export LD_LIBRARY_PATH

Internal Use Only

This technote was generated by Technote Kickstart based off of Information Management PMR #12282,344,000

[{"Product":{"code":"SSVT2J","label":"Informix Tools"},"Business Unit":{"code":"BU001","label":"Analytics Private Cloud"},"Component":"Informix Client Software Development Kit (CSDK)","Platform":[{"code":"PF016","label":"Linux"}],"Version":"3.5","Edition":""}]

Document Information

Modified date:
23 July 2019

UID

swg21454845