Linux-Informix-PHP Problem: pdo_informix

After a lot of struggles, I managed to install, php with apache on a Linux Ubuntu server and Informix.

When I create the file db2.php to create a database connection to Informix then I get the following message:


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

I have been "pulling my hair" for some hours :-) Hopefully any of you folks have run into something similar and have some thoughts.

Thanks!
ckercherAsked:
Who is Participating?
 
ckercherConnect With a Mentor Author Commented:
With the help of IBM technical support, we were able to solve the problem.
0
 
ste5anSenior DeveloperCommented:
What have you installed?

  http://forums.gentoo.org/viewtopic.php?t=245249

How do you try to connect to your Informix database?

  http://php.net/manual/en/function.odbc-connect.php


mfG
--> stefan <--
0
 
jhp333Commented:
You can use "finderr 23101" command to see the detailed error message.

The following is the details of Informix error 23101:
-23101  Unable to load locale categories.

An invalid locale name was supplied for the locale initialization.
The environment variable specifying the locale category has a wrong
value.

Check the value of the corresponding environment variable,
CLIENT_LOCALE or DB_LOCALE. If this error was encountered when using
the "SET COLLATION" statement, check that the value passed to the
statement is a valid locale. If this error was encountered when using
the "SET NO COLLATION" statement, check that the session's default
locale file is still available. Also check if INFORMIXDIR points to
a valid directory where IBM Informix products are installed.  

If a client application receives this error when it requests a database
server connection, check that the client and database locales are
compatible. They are compatible if a valid locale exists on the server
computer with the name lg_tr.codeset@mod, where lg_tr (language and
territory) and mod (locale modifier) are from the CLIENT_LOCALE and
codeset is from the database locale (from the DB_LOCALE, if it is set,
or as stored in the database).
------------------------------------------------------

You may need to read Informix GLS User's guide:
http://publib.boulder.ibm.com/infocenter/idshelp/v111/index.jsp?topic=/com.ibm.glsug.doc/glsug.htm
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
gheistCommented:
can you use dbaccess as apache account?
0
 
jlar310Commented:
The error you reference is typical of a missing INFORMIXDIR environment variable. This variable must be set in the environment of the apache process.

I have this working on CentOS. CentOS puts some general configuration files in /etc/sysconfig. I believe the equivalent for Ubuntu would be /etc/default.

In my /etc/sysconfig/httpd (Ubuntu = /etc/default/apache2) I have

export INFORMIXDIR=/path/to/your/informix
export INFORMIXSERVER=yourinformixservername

Ubunutu uses /bin/sh to launch apache as opposed to /bin/bash for CentOS, so you may need a different syntax to export the environment variables.

Then in your apache configuration you need

PassEnv INFORMIXDIR INFORMIXSERVER




0
 
ckercherAuthor Commented:
Thank you all for your comments/contributions.

My variables are set properly. These are the values for those variables in the odbc.ini file:

CLIENT_LOCALE=en_us.8859-1
DB_LOCALE=en_us.8859-1

According to the Informix tech support folk, the connection should be established. But it isn't. So, I am still looking for some assistance on this matter!

Thanks a lot!

Ysais.

0
 
gheistCommented:
ODBC.INI has no influence on pdo_informix
try running ldd against pdo_informix, maybe you informixdir contains old software...
0
 
ckercherAuthor Commented:
All the software seems to up to date but nothing yet. According to the IBM support people it has to do with environment variables but all my variables are properly set. I am still into this error message. Thank you folks for your comments and I appreciate any further comments.
0
 
gheistCommented:
try checking phpinfo() if all your variables are really set ;)
0
 
gheistCommented:
http:#a33674330 is first that explains everything.
0
All Courses

From novice to tech pro — start learning today.