-11041 error "Unspecified System Error" when trying to connect to IBM Informix database using the PDO_INFORMIX php driver.
SQLSTATE=HY000, SQLDriverConnect: -11041 [Informix][Informix ODBC Driver][Informix]Unspecified System Error = -11041
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.
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
Internal Use Only
This technote was generated by Technote Kickstart based off of Information Management PMR #12282,344,000
23 July 2019