Informix PDO and XAMPP

0

Greetings to all and in advance thanks to any answer and / or help you may receive.

I have problems connecting PHP 5.6.24 of XAMPP to an INFORMIX server that is not on my local machine.

Install the Informix CSDK, I made the respective configuration and from the conectTest I connect correctly to the Database and I can make test queries from there.

Now, in PHP, nothing works for me, download the php_pdo_informix.dll library, enable it in PHP.ini and restart Apache, all right, I make a simple test connection like this:

try {
   $db = new PDO("informix:DSN=MyDSN", "srvapp", "miclave");
} catch (PDOException $e) {
   echo 'Error de Conexion: '. $e->getMessage();
}

and the answer that returns to me is: could not find driver.

I have seen a lot of POST and they make it very easy, but nothing really works for me, the whole configuration if it works, I connect and consult, but from PHP nothing.

I hope you can help me with this topic. Thanks

Greetings

    
asked by Mixzplit 03.02.2017 в 14:06
source

2 answers

1

Here I put the step by step to my question, already working.

Install Informix Driver for PHP Install Informix SDK

export INFORMIXDIR=/opt/IBM/informix
PATH=$PATH:$INFORMIXDIR/bin
tar -xvf clientsdk.4.10.FC8DE.LINUX.tar
./installclientsdk

enter enter 1 enter enter enter enter

Install PDO Informix

apt-get install php5-dev
tar -xvzf PDO_INFORMIX-1.3.1.tgz
cd PDO_INFORMIX-1.3.1/
phpize --with-php-config=/usr/bin/php-config
./configure --with-php-config=/usr/bin/php-config

You are going to throw away that you can not find php_pdo_driver.h, and you have to edit the configure to search in /usr/include/php5/ext/pdo/php_pdo_driver.h

updatedb
locate php_pdo_driver.h
vi configure

Run again

./configure --with-php-config=/usr/bin/php-config

Edit the Makefile and add /opt/IBM/informix/lib/esql/checkapi.o

vi Makefile

It should be like this

PDO_INFORMIX_SHARED_LIBADD = -Wl,-rpath,/root/PDO_INFORMIX-1.3.1/. -
L/root/PDO_INFORMIX-1.3.1/. -Wl,-rpath,/opt/IBM/informix/lib/esql -
L/opt/IBM/informix/lib/esql -Wl,-rpath,/opt/IBM/informix/lib/cli -
L/opt/IBM/informix/lib/cli -Wl,-rpath,/opt/IBM/informix/lib -
L/opt/IBM/informix/lib -lifcli -lifdmr -lifsql -lifasf -lifgen -lifos -lifgls -ldl -lcrypt /opt/IBM/informix/lib/esql/checkapi.o -lifglx

make
make install

Activate the driver in PHP

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

Enable Informix variables for Apache

vi /etc/apache2/envvars

Add to the end

export INFORMIXDIR=/opt/IBM/informix
export LD_LIBRARY_PATH=/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

Restart Apache

/etc/init.d/apache2 restart

To Test

 vi /opt/IBM/informix/etc/sqlhosts

Add to the end

host  protocolo  ip  puerto

Create a php with the following

<?php phpinfo();?>

In the PDO section we should see the pdo_informix

Then a PHP connection file is created and we prove that everything is fine.

It cost me a little time and help from a partner, but in the end we managed to install the driver in PHP 5.6.30

Greetings and I hope you can use them if you want to connect Informix with PHP

    
answered by 13.06.2017 / 16:45
source
1

That message comes out because PHP does not recognize the dll, you can confirm it in the php_info (), checking, there are only dll of the php version 5.4 below, for the new versions of php can only be installed in linux.

A colleague managed to get the dll for version 5.6 but at the moment I do not have it to publish it.

Anyway, I leave the link: link

That has the dll for windows and packages for linux.

    
answered by 09.06.2017 в 16:18