PHP and Informix on Debian - how to install/configure the PDO
Asked Answered
P

2

9

This question seems to be asked quite a bit and the answer seems to change with time. I've spent the weekend getting the IBM Client SDK for Informix working on Debian (because most directions on the process are lacking, so this took a weekend to sort out.) I can connect and run queries to a remote Informix server with isql now - no problem. Now I need PHP to connect so that I can render output to apache. This syntax;

<?php
try {
    $dbh = new PDO("informix:DSN=InformixDB", "username", "password");
    }
catch (PDOException $e)
    {
    echo $e->getMessage();
    }
 ?>

Produces a "could not find driver" error on the web page (this is generic syntax - I fill in the information of course). From what I have read, a php Informix PDO driver needs to be installed, but I can't find a how-to. It used to be that it was install with PECL(?), now it's not. Does someone know? I have installed the following PHP packages;

php5 php5-dev php5-cli

Any help is very much appreciated.

Pollack answered 11/11, 2013 at 14:45 Comment(6)
Make sure you have extensions=pdo_informix.so uncommented in your PHP.ini file. Also have a look hereStrickland
Hi Ben - I don't have a file called pdo_informix.so on my system. How does this get installed?Pollack
Why did you think that installing libmysqlclient15-dev would help?Koy
That's for something else. I copied and pasted my install line. I'll edit.Pollack
How did you get IBM Client SDK for Informix working on Debian? I am looking for a Informix driver to work with unixODBC.Vareck
Hi Danjal, you will need install Oracle Java on the server first (instructions on how to do this can be found via Google easily.) After that, you can install the Informix Client SDK, just choose all of the default settings. After that, you can install the unixODBC, followed by adding your environmental variables in /etc/ld.so.conf so that your Informix files can be found.Pollack
J
17

This answer is how I configure and installed Informix PDO at OpenSuse 12.3
I think they should apply to Debian too, except the apache set.
If have some detail about Debian to add, please fell free to edit or add at the comment.

Observation : Nothing of ODBC was used here... only pure PDO...

All was executed with user root
1) download last version of PDO

$ mkdir pdo
$ cd pdo
$ wget http://pecl.php.net/get/PDO_INFORMIX-1.3.1.tgz
--2013-11-12 12:21:51--  http://pecl.php.net/get/PDO_INFORMIX-1.3.1.tgz
Resolving pecl.php.net (pecl.php.net)... 76.75.200.106
Connecting to pecl.php.net (pecl.php.net)|76.75.200.106|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 67566 (66K) [application/octet-stream]
Saving to: `PDO_INFORMIX-1.3.1.tgz'

100%[=====================================================================================================================================================================================>] 67,566      --.-K/s   in 0.04s

2013-11-12 12:21:52 (1.57 MB/s) - `PDO_INFORMIX-1.3.1.tgz' saved [67566/67566]

2) uncompress

$ tar zxf PDO_INFORMIX-1.3.1.tgz
$ cd PDO_INFORMIX-1.3.1/

3) set your INFORMIXDIR

$ export INFORMIXDIR=/myifx/csdk

3) execute phpize

$ phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions

3) execute the ./configure

$ ./configure
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... -std=gnu99
checking for gcc -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for icc... no
checking for suncc... no
checking whether gcc -std=gnu99 and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib64/php5/extensions
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for Informix driver for PDO... yes, shared
checking for PDO includes... configure: error: Cannot find php_pdo_driver.h.

Ooops.. this is bug at Opensuse, not sure if can occur to Debian too...
Need to correct the path of php_pdo_driver.h at ./configure and rerun.

$ grep php_pdo_driver.h configure
  if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
  elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
  elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
    as_fn_error $? "Cannot find php_pdo_driver.h." "$LINENO" 5

$ locate php_pdo_driver.h
/usr/include/php5/ext/pdo/php_pdo_driver.h


$ sed -ie 's,include/php/ext/pdo/php_pdo_driver.h,include/php5/ext/pdo/php_pdo_driver.h,g' configure

$ ./configure
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... -std=gnu99
checking for gcc -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for icc... no
checking for suncc... no
checking whether gcc -std=gnu99 and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib64/php5/extensions
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for Informix driver for PDO... yes, shared
checking for PDO includes... /usr/include/php/ext
checking for includes and libraries... /myifx/informix
checking Informix version... 370
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc -std=gnu99... /usr/x86_64-suse-linux/bin/ld
checking if the linker (/usr/x86_64-suse-linux/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/x86_64-suse-linux/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from gcc -std=gnu99 object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc -std=gnu99 supports -fno-rtti -fno-exceptions... no
checking for gcc -std=gnu99 option to produce PIC... -fPIC -DPIC
checking if gcc -std=gnu99 PIC flag -fPIC -DPIC works... yes
checking if gcc -std=gnu99 static flag -static works... no
checking if gcc -std=gnu99 supports -c -o file.o... yes
checking if gcc -std=gnu99 supports -c -o file.o... (cached) yes
checking whether the gcc -std=gnu99 linker (/usr/x86_64-suse-linux/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands

4) compile the PDO

$ make
/bin/sh /root/pdo/PDO_INFORMIX-1.3.1/libtool --mode=compile gcc -std=gnu99 -I/usr/include/php/ext -I. -I/root/pdo/PDO_INFORMIX-1.3.1 -DPHP_ATOM_INC -I/root/pdo/PDO_INFORMIX-1.3.1/include -I/root/pdo/PDO_INFORMIX-1.3.1/main -I/root/pdo/PDO_INFORMIX-1.3.1 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/myifx/csdk/incl/cli -I/myifx/csdk/incl/esql  -DHAVE_CONFIG_H  -g -O2   -c /root/pdo/PDO_INFORMIX-1.3.1/pdo_informix.c -o pdo_informix.lo
libtool: compile:  gcc -std=gnu99 -I/usr/include/php/ext -I. -I/root/pdo/PDO_INFORMIX-1.3.1 -DPHP_ATOM_INC -I/root/pdo/PDO_INFORMIX-1.3.1/include -I/root/pdo/PDO_INFORMIX-1.3.1/main -I/root/pdo/PDO_INFORMIX-1.3.1 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/myifx/csdk/incl/cli -I/myifx/csdk/incl/esql -DHAVE_CONFIG_H -g -O2 -c /root/pdo/PDO_INFORMIX-1.3.1/pdo_informix.c  -fPIC -DPIC -o .libs/pdo_informix.o
/bin/sh /root/pdo/PDO_INFORMIX-1.3.1/libtool --mode=compile gcc -std=gnu99 -I/usr/include/php/ext -I. -I/root/pdo/PDO_INFORMIX-1.3.1 -DPHP_ATOM_INC -I/root/pdo/PDO_INFORMIX-1.3.1/include -I/root/pdo/PDO_INFORMIX-1.3.1/main -I/root/pdo/PDO_INFORMIX-1.3.1 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/myifx/csdk/incl/cli -I/myifx/csdk/incl/esql  -DHAVE_CONFIG_H  -g -O2   -c /root/pdo/PDO_INFORMIX-1.3.1/informix_driver.c -o informix_driver.lo
libtool: compile:  gcc -std=gnu99 -I/usr/include/php/ext -I. -I/root/pdo/PDO_INFORMIX-1.3.1 -DPHP_ATOM_INC -I/root/pdo/PDO_INFORMIX-1.3.1/include -I/root/pdo/PDO_INFORMIX-1.3.1/main -I/root/pdo/PDO_INFORMIX-1.3.1 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/myifx/csdk/incl/cli -I/myifx/csdk/incl/esql -DHAVE_CONFIG_H -g -O2 -c /root/pdo/PDO_INFORMIX-1.3.1/informix_driver.c  -fPIC -DPIC -o .libs/informix_driver.o
/root/pdo/PDO_INFORMIX-1.3.1/informix_driver.c: In function 'dbh_prepare_stmt':
/root/pdo/PDO_INFORMIX-1.3.1/informix_driver.c:133:3: warning: implicit declaration of function 'stmt_cleanup' [-Wimplicit-function-declaration]
/bin/sh /root/pdo/PDO_INFORMIX-1.3.1/libtool --mode=compile gcc -std=gnu99 -I/usr/include/php/ext -I. -I/root/pdo/PDO_INFORMIX-1.3.1 -DPHP_ATOM_INC -I/root/pdo/PDO_INFORMIX-1.3.1/include -I/root/pdo/PDO_INFORMIX-1.3.1/main -I/root/pdo/PDO_INFORMIX-1.3.1 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/myifx/csdk/incl/cli -I/myifx/csdk/incl/esql  -DHAVE_CONFIG_H  -g -O2   -c /root/pdo/PDO_INFORMIX-1.3.1/informix_statement.c -o informix_statement.lo
libtool: compile:  gcc -std=gnu99 -I/usr/include/php/ext -I. -I/root/pdo/PDO_INFORMIX-1.3.1 -DPHP_ATOM_INC -I/root/pdo/PDO_INFORMIX-1.3.1/include -I/root/pdo/PDO_INFORMIX-1.3.1/main -I/root/pdo/PDO_INFORMIX-1.3.1 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/myifx/csdk/incl/cli -I/myifx/csdk/incl/esql -DHAVE_CONFIG_H -g -O2 -c /root/pdo/PDO_INFORMIX-1.3.1/informix_statement.c  -fPIC -DPIC -o .libs/informix_statement.o
/bin/sh /root/pdo/PDO_INFORMIX-1.3.1/libtool --mode=link gcc -std=gnu99 -DPHP_ATOM_INC -I/root/pdo/PDO_INFORMIX-1.3.1/include -I/root/pdo/PDO_INFORMIX-1.3.1/main -I/root/pdo/PDO_INFORMIX-1.3.1 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/myifx/csdk/incl/cli -I/myifx/csdk/incl/esql  -DHAVE_CONFIG_H  -g -O2   -o pdo_informix.la -export-dynamic -avoid-version -prefer-pic -module -rpath /root/pdo/PDO_INFORMIX-1.3.1/modules  pdo_informix.lo informix_driver.lo informix_statement.lo -Wl,-rpath,/root/pdo/PDO_INFORMIX-1.3.1/. -L/root/pdo/PDO_INFORMIX-1.3.1/. -Wl,-rpath,/myifx/csdk/lib/esql -L/myifx/csdk/lib/esql -Wl,-rpath,/myifx/csdk/lib/cli -L/myifx/csdk/lib/cli -Wl,-rpath,/myifx/csdk/lib -L/myifx/csdk/lib -lifcli -lifdmr -lifsql -lifasf -lifgen -lifos -lifgls -ldl -lcrypt -lifglx
libtool: link: gcc -std=gnu99 -shared  -fPIC -DPIC  .libs/pdo_informix.o .libs/informix_driver.o .libs/informix_statement.o   -L/root/pdo/PDO_INFORMIX-1.3.1/. -L/myifx/csdk/lib/esql -L/myifx/csdk/lib/cli -L/myifx/csdk/lib -lifcli -lifdmr -lifsql -lifasf -lifgen -lifos -lifgls -ldl -lcrypt -lifglx  -O2 -Wl,-rpath -Wl,/root/pdo/PDO_INFORMIX-1.3.1/. -Wl,-rpath -Wl,/myifx/csdk/lib/esql -Wl,-rpath -Wl,/myifx/csdk/lib/cli -Wl,-rpath -Wl,/myifx/csdk/lib   -Wl,-soname -Wl,pdo_informix.so -o .libs/pdo_informix.so
libtool: link: ( cd ".libs" && rm -f "pdo_informix.la" && ln -s "../pdo_informix.la" "pdo_informix.la" )
/bin/sh /root/pdo/PDO_INFORMIX-1.3.1/libtool --mode=install cp ./pdo_informix.la /root/pdo/PDO_INFORMIX-1.3.1/modules
libtool: install: cp ./.libs/pdo_informix.so /root/pdo/PDO_INFORMIX-1.3.1/modules/pdo_informix.so
libtool: install: cp ./.libs/pdo_informix.lai /root/pdo/PDO_INFORMIX-1.3.1/modules/pdo_informix.la
libtool: finish: PATH="/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:~/bin:/sbin" ldconfig -n /root/pdo/PDO_INFORMIX-1.3.1/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /root/pdo/PDO_INFORMIX-1.3.1/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

5) install the PDO

$ make install
Installing shared extensions:     /usr/lib64/php5/extensions/

$ ls -ltr /usr/lib64/php5/extensions/ | tail
-rw-r--r-- 1 root root   85720 Jul 16 08:19 sqlite.so
-rw-r--r-- 1 root root   49840 Jul 16 08:19 sqlite3.so
-rw-r--r-- 1 root root   48048 Jul 16 08:19 sockets.so
-rw-r--r-- 1 root root   35760 Jul 16 08:19 xmlreader.so
-rw-r--r-- 1 root root   18928 Jul 16 08:19 tokenizer.so
-rw-r--r-- 1 root root   14864 Jul 16 08:19 sysvshm.so
-rw-r--r-- 1 root root   40224 Jul 16 08:19 zlib.so
-rw-r--r-- 1 root root  102264 Jul 16 08:19 zip.so
-rw-r--r-- 1 root root   52016 Jul 16 08:19 xmlwriter.so
-rwxr-xr-x 1 root root  164722 Nov 12 12:29 pdo_informix.so

6) Active the PDO at PHP

$ cd /etc/php5/conf.d
$ echo "extension=pdo_informix.so" > pdo_informix.ini

7) "Active" the INFORMIX variables at Apache. here, probably will be different for debian.

$ cd /etc/sysconfig/

$ tail apache2
#
# If mod_status is used, include extended information about the server, like
# CPU usage, in the status report. It is a server-wide setting, and it can cost
# some performance!
#
APACHE_EXTENDED_STATUS="off"

INFORMIXDIR=/myifx/csdk
LD_LIBRARY_PATH=/myifx/csdk/lib:/myifx/csdk/lib/esql:/myifx/csdk/lib/client:/myifx/csdk/lib/cli:$LD_LIBRARY_PATH

8) restart apache

$ systemctl restart apache2.service

9) Then I able to access using this PHP...

$ cd /srv/www/htdocs
$ cat ifx.php
<?php

$db = new PDO("informix:host=myifx_ifxhom; service=11205; database=xyz; server=idsbkp_soc; protocol=onsoctcp; EnableScrollableCursors=1", "cesar", "cesar");

print "Connection Established!\n\n";

$stmt = $db->query("select * from systables");
$res = $stmt->fetch( PDO::FETCH_BOTH );
$rows = $res[0];
echo "Table contents: $rows.\n";

?>

You can check if you apache loaded the Informix PDO with php_info : php_info pdo_informix And check if the Informix variables was recognized by apache: phpinfo environment variables Using this code:

$ cat phpinfo.php
<?php

// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);

?>
Jose answered 12/11, 2013 at 14:46 Comment(17)
Thank you, ceinmart, as usual. I spent all day yesterday trying to work through this (and failing). I will comb through this and starting working through it. Thanks again, as always.Pollack
ok, just please, only mark the answer as accepted if they apply and solve your problem... because this is the concept of stackexchange and otherwise anyone will not post other answer since you already marked as OK / Solved.Jose
Okay. I'll be applying these steps to Debian, so I'll mark any changes in an edit, if that sounds okay?Pollack
As you predicted, step 7 is different on Debian than on suse. I'm working on figuring out where in Apache2 for Debian I can add these lines, my best guess so far is that they are added to apache2.conf but because I've not set up PDO on apache before, I can't tell if this is correct. Anyway, can you tell me was sysconfig is used for on suse? I'll try to find the equivalent on debian. Also, when I make the changes and restart apache, when can I look to see that the settings are accepted (is there, like, a phpinfo() I can invoke for apache?).Pollack
Oh, now that I look at step 9, it says that I can check if apache loaded the informix PDO (it has). Still, not sure why step 7 was maybe not needed?Pollack
Answering the first question, about step 7. The /etc/sysconfig/apache2 file is a shell which is executed at startup script /etc/init.d/apache2 (system V standard) like this : . /etc/sysconfig/apache2 this way the variables was set at current session (when the service is started) before the script apache2 execute the httpd command to effectively start apache.Jose
answering the second question, No , the load of php_informix do not means they will work. Is just saying the module/client of Informix was recognized by apache, but you should see at phpinfo , "Environment" session the informix variables defined (I will update the answer with that).Jose
Hi ceinmart (thank you for replying). Yes, everything in the Environment section you posted in the answer above is missing in my setup. I've been hunting down some problems in a separate post serverfault.com/questions/557407/… , but I suspect that it's related to my problems with step 7 (although I'm glad it appears to be isolated). I haven't found any good answers for this on Debian/Ubuntu. Someone recommended putting these in /etc/apache2/envvars, but it didn't work. Any ideas?Pollack
If you able to start apache manually , running the "httpd" command, just set the informix variables before and at same session start the httpd, as far I know, they should "get" the Informix variables... if not, there is some security trick there to solve...Jose
Hi, ceinmart. It looks like I'm getting closer. In your step 7, I had to change my step so that I add "export" syntax to /etc/apache2/envvars. When I add these lines export INFORMIXDIR=/opt/IBM/informix export LD_LIBRARY_PATH=/opt/IBM/informix/lib:/opt/IBM/informix/lib/esql:/opt/IBM/informix/lib/client:/opt/IBM/informix/lib/cli:$LD_LIBRARY_PATH export APACHE_EXTENDED_STATUS="off" my error goes away. I'm getting closer, my error has changed to SQLSTATE=HY000, SQLDriverConnect: -23197 [Informix][Informix ODBC Driver][Informix]Database locale information mismatch. cont'd . . .Pollack
This tells me that a connection is at least being made and it doesn't like something (no?). Your updated edit in step 7 shows a variable called LC-CTYPE, which looks like a locale setting. I added this, but it didn't change anything. Have you seen this before? Maybe I need to adjust something in my client SDK? It's an odd error.Pollack
Yes, you connect to the database... now we are talking about database vs client misconfiguration , check about the error at manual : pic.dhe.ibm.com/infocenter/informix/v121/topic/com.ibm.em.doc/…Jose
I believe I've figured out how to fit the step 7 syntax to Debian/Apache2. /etc/apache2/envvars should include export DB_LOCALE=en_us.57372 export CLIENT_LOCALE=en_us.CP1252. Now, the errors are gone when try { $db = new PDO("informix:host=IPADDRESS;service=DB_SERVER_PORT;database=DATABASE;server=INFORMIX_SERVER_NAME;protocol=onsoctcp;EnableScrollableCursors=1","INFORMIX_USERNAME", "INFORMIX_USERNAME_PASSWORD"); } catch (PDOException $e) { echo $e->getMessage(); } Just checking, but a blank reply is good, yeah? :)Pollack
Yes! congrats! You did!Jose
Yaaaay! That was very difficult, ceinmart. I'm working on documentation this morning so that I can recreate the server easily, because this was a lot harder than I thought it was going to be and I never want to go through this again ;) PDO looks different from how I've done things with mysqli. I've already put together a small query, but so far it looks like the resulting output from PDO is blank (var_dump is empty. Very odd). I'm going to post questions on that in a separate thread. Thank you, ceinmart. I'm very grateful for your help.Pollack
I can confirm that adding export INFORMIXDIR=... to /etc/apache2/envvars works in Ubuntu 12.04. That was the only variable I had to add... no need for LD_LIBRARY_PATH. Previously I tried using SetEnv INFORMIXDIR ... inside a <Directory> in my Apache config file, but that didn't work.Accomplish
I used this info to install on a Raspberry Pi with debian. It works!!! Thanks!!! I had the sed trick with php_pdo_driver.h. I use php5-fpm with nginx so I had to add the ENV variables to /etc/default/php5-fpm and in /etc/php5fpm/pool.d/www.conf set clear_env = no then it works like a charm!Jailhouse
S
0

I'm receiving this error: SQLSTATE=HY000, SQLDriverConnect: -23101 [Informix][Informix ODBC Driver][Informix]Unspecified System Error = -23101

I've tryed to setenv INFORMIXDIR, DB_LOCALE and CLIENT_LOCALE on apache config, but does not work.

Apache Environment

Here is my connection string:

$instance = new PDO("informix:host=$host;service=$port;database=$db;server=ol_standard;protocol=onsoctcp;client_locale=en_US.819;db_locale=en_US.819;EnableScrollableCursors=1;OPTIMIZEAUTOCOMMIT=1", "informix", "");
Siriasis answered 10/10, 2017 at 12:40 Comment(1)
Did you add the following syntax to /etc/apache2/envvars? export INFORMIXDIR=/opt/IBM/informix export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:/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 APACHE_EXTENDED_STATUS="off" export DB_LOCALE=en_us.57372 export CLIENT_LOCALE=en_us.CP1252Pollack

© 2022 - 2024 — McMap. All rights reserved.