RE: PHP and Informix?
Posted in 2011
Topics: Installation, Setup & Upgrades, Connectivity: ODBC / JDBC / .NET
> From: Art Kagel [mailto:art.kagel@gmail.com] > > Check out this link: > > http://publib.boulder.ibm.com/infocenter/idshelp/v115/index.jsp?topic=/com.ibm.conn.doc/php.htm > > The "db2 driver" is any of several packages. The link above notes > that the easiest to use is "IBM Data Server Driver for ODBC and CLI" > found > at: > > https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?lang=en_US&source=swg-informixfpd > > installation instructions are at: > > http://publib.boulder.ibm.com/infocenter/idshelp/v115/index.jsp?topic=/com.ibm.conn.doc/installcli.htm Thanks, this got me started. The link you provided got me is the 9.5 version though. On a separate route through the corporate homepage hell I got the latest 9.7 version. It might be found here, if you're lucky: http://www-01.ibm.com/software/data/db2/linux-unix-windows/download.html -> Data Server Client Packages (GA level) -> IBM Data Server Driver for ODBC and CLI (CLI Driver) -> Choose your platform and download. Then, you download the latest fixpack. The reason for the GA download is that the fixpack does not contain the header files which you'll need to build pdo_ibm. http://www-01.ibm.com/software/data/db2/linux-unix-windows/download.html -> Data Server Client Packages (latest fixpacks) -> Choose the latest version which matches with tha GA release and download the fixpack. But even this is not enough. These fixpacks (at least for 32bit linux) use security32/plugin/IBM/client/IBMOSauthclient.so.1, which is linked against libdb2osse.so.1 which is NOT included. If you're trying to make an RPM package then rpm will complain that you don't have libdb2osse.so.1 installed. I don't know what it does or if it's actually required but why link against it then? It is shipped with the DB2 Client (v9.7fp3a_linuxia32_client_conpe_t.tar.gz), which can be found on the same fixpack page. Choose Client instead of Cli and ODBC driver. You only need the latest fixpack. I couldn't figure out how to extract the .so without installing the package. But fortunately I had junk VM's lying around. From an installation there I copied the libdb2osse.so.1 file. So to install this package, which is required by pdo_ibm, I have this script (from the install section of my rpm spec file): ## installdir is something like /opt/ibmclidriver mkdir -p %{buildroot}%{installdir} cd %{buildroot}%{installdir} ## extract the GA version, which includes the header files tar -zx --strip-components=2 -f %{_sourcedir}/ibm_data_server_driver_for_odbc_cli_32_linuxia32_v97.tar.gz ## overwrite with the fixpack. Kind of an upgrade tar -zx --strip-components=2 -f %{_sourcedir}/v9.7fp3a_linuxia32_odbc_cli.tar.gz ## install the libdb2osse.so.1 library on the system mkdir -p %{buildroot}%{_libdir} cp %{_sourcedir}/libdb2osse.so.1 %{buildroot}%{_libdir} cd %{buildroot}%{_libdir} ln -s libdb2osse.so.1 libdb2osse.so Now the pdo_ibm install is simple, provided you have the pdo header files installed, probably the php-devel package. This is for SLES11SP1, but can be changed for any other distro: %build phpize %configure --with-pdo-ibm=/opt/ibmclidriver make %install mkdir -p %{buildroot}%{extension_dir} mkdir -p %{buildroot}%{php_module_conf_dir} cp modules/%{module_name}.so %{buildroot}%{extension_dir} echo "extension=%{module_name}.so" > %{buildroot}%{php_module_conf_dir}/%{module_name}.ini Hope this helps someone, Aleksander Kamenik System Administrator Krediidiinfo AS an Experian Company Phone: +372 665 9649 Email: aleksander@krediidiinfo.ee
On 30 Mrz., 13:11, "Kamenik, Aleksander" <aleksander.kame...@krediidiinfo.ee> wrote: > Thanks, this got me started. [ long odyssey through installation steps deleted... ] This is what I meant. Why does IBM require potential users to go through such an ordeal? Thanks for any hints I got through this thread and via mail so far. So far no success yet, but in my special case this is not only IBM's fault, but also the complicatedness of the target PHP system. It is a pre-configured XAMPP server (32bit) running under SLES10 64bit, and even though the admin of this system has been very active trying to get it to run, we haven't got anywhere with the PDO_IBM driver. With the PDO_Informix driver, we are at least getting somewhere, but there seems to be some quirk with the INFORMIXSERVER environment variable. If it is NOT set when calling the php test script, we get the dreaded -23101 error. When it is set, we get error "Unable to load translation shared library (DLL)". Since I have very little insight into the PHP system, I haven't been able to identify the problem. Any ideas? Regards, Richard
> This is what I meant. Why does IBM require potential users to go
> through such an ordeal?
IBM isn't the only one. I guess bureaucracy creates this mess. If only I could say HP or Novell or any other big corp were any better in this regard. They all suck. ymmv
>
> Thanks for any hints I got through this thread and via mail so far. So
> far no success yet, but in my special
> case this is not only IBM's fault, but also the complicatedness of the
> target PHP system. It is a pre-configured
> XAMPP server (32bit) running under SLES10 64bit, and even though the
> admin of this system has been
> very active trying to get it to run, we haven't got anywhere with the
> PDO_IBM driver.
What's the error message? I had no problems whatsoever building the pdo module once I had the required libraries installed.
I remember having lots of problems with SLES and configure finding the pdo header files. A symlink helped:
lrwxrwxrwx 1 root root 17 Sep 1 2010 /usr/include/php -> /usr/include/php5
drwxr-xr-x 8 root root 4096 Mar 10 19:47 /usr/include/php5
Make sure the header files and libraries match versions too. If you installed php manually you may have newer/older version in the php include directory.
Maybe you have to do this with /usr/lib[64]/php5 too. My current RPM build host does not have this symlink.
I'm on 32bit too though, maybe you have 64bit related problems.
> With the PDO_Informix driver, we are at least getting somewhere, but
> there seems to be some quirk with
> the INFORMIXSERVER environment variable. If it is NOT set when calling
> the php test script, we get the
> dreaded -23101 error. When it is set, we get error "Unable to load
> translation shared library (DLL)".
> Since I have very little insight into the PHP system, I haven't been
> able to identify the problem. Any ideas?
Yes! I have this file in profile.d and also source it at the end of /etc/sysconfig/apache2 (I'm using SLES too, 11 SP1 though):
cat /etc/profile.d/informix.sh
#!/bin/bash
INFORMIXSERVER=server_name
INFORMIXDIR=/opt/informix
ONCONFIG=onconfig
DBDATE=DMY4/GL_DATE=%d/%m/%Y
INFORMIXSQLHOSTS=$INFORMIXDIR/etc/sqlhosts
if test -z "$PROFILEREAD"
then
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/tools:$INFORMIXDIR/lib/cli
PATH=$PATH:$INFORMIXDIR/bin
export LD_LIBRARY_PATH PATHfi
export INFORMIXSERVER INFORMIXDIR ONCONFIG DBDATE GL_DATE
## EOF
DBDATE and GL_DATE are of course installation and "locale" specific, you probably don't have to set these. I think you don't have the informix install path in LD_LIBRARY_PATH, that's why it can't load the "DLL".
The reason to add the "source /etc/profile.d/informix.sh" line at the end of /etc/sysconfig/apache2 is that the profiles have not been sourced yet when the server boots and starts apache. Without it after a server reboot your informix connections will fail. It's also good for making sure the correct INFORMIXSERVER variable is set.
Yes, the PHP informix modules are a pain in the ass to setup. I have all this in RPM spec files as scripts and don't worry about it anymore. zypper install php5-pdo_informix and everything is set up automagically.
Regards,
Aleksander Kamenik
System Administrator
Krediidiinfo AS
an Experian Company
Phone: +372 665 9649
Email: aleksander@krediidiinfo.ee