I get the following error when i run apache 2.4 with php 8.1.2, but it works from command line.
The driver is ibm V11.5.7 with license community edition.
I set the DB2 instance and chmod 777 the sqllib.
I think its runs by www-data or root. When i exec isql, is by xx user, the root user dont have the path append.
PD: if i exec "sudo isql xx xx xx" get a similar error '[IM004][unixODBC][DriverManager] Driver 's SQLAllocHandle on SQL_HANDLE_HENV failed.
[ISQL] ERROR:Could not SQLConnect
My odbcinst file
[ODBC Data Sources]
[IBM i Access ODBC Driver]
Driver=/home/xx/sqllib/lib32/libdb2.so
Driver64=/home/xx/sqllib/lib64/libdb2.so
IBM_DB_HOME=/home/xx/sqllib
LD_LIBRARY_PATH=/home/xx/sqllib/lib64:/home/xx/sqllib/lib64/gskit:/home/xx/sqllib/lib32
PATH of xx have /home/xx/sqllib/bin
My Answer:
It looks like there may be an issue with the configuration of your ODBC driver for IBM DB2. Here are a few things you can try to troubleshoot the issue:
1. Check the permissions of the ODBC configuration files: Make sure that the ODBC configuration files (odbcinst.ini, odbc.ini) have the correct permissions and are accessible by the user running Apache.
2. Verify the ODBC driver configuration: Double-check the paths to the ODBC driver files in your odbcinst.ini file and make sure they are correct.
3. Check the environment variables: Ensure that the IBM_DB_HOME, LD_LIBRARY_PATH, and PATH environment variables are set correctly for the user running Apache. You may need to set these variables in the Apache configuration file or in a script that starts Apache.
4. Test the ODBC connection: Try running a simple ODBC connection test using isql from the command line to see if you can connect to the DB2 database. This can help identify if the issue is with the ODBC driver configuration or with the Apache setup.
5. Check for any SELinux or firewall restrictions: Make sure that SELinux or any firewall settings are not blocking the connection to the DB2 database.
If you continue to experience issues, you may want to consult the IBM DB2 documentation or reach out to IBM support for further assistance with configuring the ODBC driver for Apache.
Rate this post
4 of 5 based on 9913 votesComments