PHP & Informix on Red Hat Enterprise 5
Posted in 2008
Topics: Installation, Setup & Upgrades, Connectivity: ESQL/C, 4GL & Embedded SQL, Networking & sqlhosts Configuration, Platform-Specific Issues, Internationalization & Character Sets
Hi,
I have Zend Core for IBM installed on a Red Hat Enterprise 5.
Im trying to connect to an IDS 10 on another server. Ive been trying for 2
days now, and nothing works
anyone have experience with the same setup and
got it to work?
What I tried first:
Modified $INFORMIXDIR/etc/sqlhosts & /etc/services.
Modified /etc/hosts.equiv on DB server to include webserver
Set INFORMIXDIR & LD_LIBRARY_PATH to point to the Zend Core directory.
Didnt work.
Then I downloaded the CSDK and pointed both to the CSDK install directory.
Didnt work.
Ive set following env variables:
export INFORMIXDIR=/opt/informix
export PATH=$INFORMIXDIR/bin:$PATH
export INFORMIXSERVER=demo_on
export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/sqlhosts
export
LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql:$LD_LIBRARY_PATH
export CLIENT_LOCALE=en_us.819
export DB_LOCALE=en_us.819
Ive tried setting them in:
/etc/profile.d/informix.sh
/etc/bashrc
ð Both show the variables as set when I echo them on the command prompt
But this didnt set them in PHP.
Ive tried adding them to the envvars file in the apache bin directory,
which gets loaded before starting httpd
Ive tried adding them in httpd.conf (KEEPENV & PUTENV)
Ive tried having them all at once
But I still cant connect
This is the script I use: (which works when I have it on windows)
(using pdo_informix)
<?php
try {
$db = new
PDO("informix:host=192.168.10.34;service=50000;database=testdb;server=demo_o
n;protocol=olsoctcp;client_locale=en_us.819;db_locale=en_us.819",
"informix", "********");
$res = $db->query("select * from users");
foreach ($res as $row) {
print_r($row);
}
echo "No error";
} catch (Exception $e) {
print_r($e);
}
?>
This is the error I get at the moment (with CSDK):
PDOException Object
(
[message:protected] => SQLSTATE=08001, SQLDriverConnect: -1013 [IBM][CLI
Driver] SQL10007N Message "0" could not be retrieved. Reason code: "3".
[string:private] =>
[code:protected] => 0
[file:protected] => /usr/local/apache2/htdocs/test.php
[line:protected] => 7
[trace:private] => Array
(
[0] => Array
(
[file] => /usr/local/apache2/htdocs/test.php
[line] => 7
[function] => __construct
[class] => PDO
[type] => ->
[args] => Array
(
[0] =>
informix:host=192.168.10.34;service=50000;database=testdb;server=demo_on;pro
tocol=olsoctcp;client_locale=en_us.819;db_locale=en_us.819
[1] => informix
[2] => ********
)
)
)
[errorInfo] =>
)
Any ideas? Would be very very very greatfull
How does pdo_ibm work with Informix btw? Tried that as well, but didnt work
either J
Tnx in advance
Jeroen Keppens
Trying building the PHP from source BUT the last time I look at this the
informix pdo was not allowed - invalid option
Cheers
Paul
Jeroen Keppens wrote:
> Hi,
>
>
>
> I have Zend Core for IBM installed on a Red Hat Enterprise 5.
>
>
>
> I'm trying to connect to an IDS 10 on another server. I've been trying
> for 2 days now, and nothing works' anyone have experience with the same
> setup and got it to work?
>
>
>
> What I tried first:
>
>
>
> Modified $INFORMIXDIR/etc/sqlhosts & /etc/services.
>
> Modified /etc/hosts.equiv on DB server to include webserver
>
>
>
> Set INFORMIXDIR & LD_LIBRARY_PATH to point to the Zend Core directory.
> Didn't work.
>
>
>
> Then I downloaded the CSDK and pointed both to the CSDK install
> directory. Didn't work.
>
>
>
> I've set following env variables:
>
>
>
> export INFORMIXDIR=/opt/informix
>
> export PATH=$INFORMIXDIR/bin:$PATH
>
> export INFORMIXSERVER=demo_on
>
> export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/sqlhosts>
> export
> LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql:$LD_LIBRARY_PATH
>
> export CLIENT_LOCALE=en_us.819
>
> export DB_LOCALE=en_us.819>
>
>
> I've tried setting them in:
>
>
>
> /etc/profile.d/informix.sh
>
> /etc/bashrc
>
> ' Both show the variables as set when I echo them on the command prompt
>
>
>
> But this didn't set them in PHP.
>
>
>
> I've tried adding them to the envvars file in the apache bin directory,
> which gets loaded before starting httpd'
>
>
>
> I've tried adding them in httpd.conf (KEEPENV & PUTENV)'
>
>
>
> I've tried having them all at once'
>
>
>
> But I still can't connect'
>
>
>
> This is the script I use: (which works when I have it on windows)
>
>
>
> (using pdo_informix)
>
>
>
> <?php
>
> try {
>
> $db = new
> PDO("informix:host=192.168.10.34;service=50000;database=testdb;server=demo_on;protocol=olsoctcp;client_locale=en_us.819;db_locale=en_us.819",
> "informix", "********");
>
> $res = $db->query("select * from users");
>
> foreach ($res as $row) {
>
> print_r($row);
>
> }
>
> echo "No error";
>
> } catch (Exception $e) {
>
> print_r($e);
>
> }
>
> ?>
>
>
>
> This is the error I get at the moment (with CSDK):
>
>
>
> PDOException Object
>
> (
>
> [message:protected] => SQLSTATE=08001, SQLDriverConnect: -1013
> [IBM][CLI Driver] SQL10007N Message "0" could not be retrieved. Reason
> code: "3".
>
>
>
> [string:private] =>
>
> [code:protected] => 0
>
> [file:protected] => /usr/local/apache2/htdocs/test.php
>
> [line:protected] => 7
>
> [trace:private] => Array
>
> (
>
> [0] => Array
>
> (
>
> [file] => /usr/local/apache2/htdocs/test.php
>
> [line] => 7
>
> [function] => __construct
>
> [class] => PDO
>
> [type] => ->
>
> [args] => Array
>
> (
>
> [0] =>
> informix:host=192.168.10.34;service=50000;database=testdb;server=demo_on;protocol=olsoctcp;client_locale=en_us.819;db_locale=en_us.819
>
> [1] => informix
>
> [2] => ********
>
> )
>
>
>
> )
>
>
>
> )
>
>
>
> [errorInfo] =>
>
> )
>
>
>
> Any ideas? Would be very very very greatfull'
>
>
>
> How does pdo_ibm work with Informix btw? Tried that as well, but didn't
> work either J
>
>
>
> Tnx in advance
>
> Jeroen Keppens
>