You are on page 1of 5

Instalar PDO_INFORMIX EN Linux (Centos)

GUIA DE INSTALACION DE PDO_INFORMIX EN CENTOS Crear un grupo de nombre informix Crear un usuario del mismo nombre (informix), el cual debe pertenecer al grupo informix creado en el paso anterior, el directorio home de este usuario debe ser /opt/IBM/informix. Observe que el home del usuario informx es la ruta donde se instalara el cliente de informix (client sdk), es decir estos deben coincidir. Descargar el clientsdk.2.90.UC4.tar de la pagina de IBM, este viene siendo el cliente, y lo puedes bajar de esta ruta : link de descarga Debes estar registrado en IBM, para que puedas bajarlo. Una vez que lo tengas descargado, lo descomprimes asi: tar -xvf clientsdk.2.90.UC4.LINUX.tar Ya descomprimido, entras a la carpeta clientsdk.2.90.UC4.LINUX.tar_FILES en consola y tecleas ./installclientsdk y sigues los pasos del instalador hasta terminar. Observa que en la instalacion del cliente sdk te pide que especifiques la ruta donde se instalara, por default te muestar /opt/IBM/informix, esta ruta debe corresponder con el home del usuario informix, creado en el primer paso, puedes cambiar la ruta a /opt/informix, pero recuerda actualizar el home del usuario informix para que quede igual, es decir as: /opt/informix, o bien dejalo como te lo muestra.

AHORA SIGUE INSTALAR EL PDO_INFORMIX, sigue estas instrucciones: Ubicate en alguna carpeta donde quieras que se descargue el software, y teclea el siguiente comando: wget http://www.pecl.php.net/get/PDO_INFORMIX-1.0.0.tgz El comando anterior te descarog el archivo PDO_IN FORMIX-1.0.0.tgz, ahora necesitas descomprimirlo, asi : tar zxf PDO_INFORMIX-1.0.0.tgz Ahora necesitamos compilar el pdo_informix, para ello necesitamos el PHPIZE, para ver si esta instalado, entraa la carpeta de pdo_informix (cd pdo_informix) y teclea simplemente phpize, si te marca que no esta instalado, entonces necesitas instalar las herramientas de desarrollo, con el siguiente comando: yum install php-devel Reinicia tu Linux Ahora si , vamos a compilar el pdo_informix, dentro de la carpeta pdo_informix, teclea los siguientes comandos: phpize

./configure make make install Busca el pdo_informix.so dentro de la carpeta modules de tu ruta actual, y pegalo en /usr/lib/php/modules ( si no existe ya).

Hasta este punto, se supone que ya tenemos el software instalado, nos falta la configuracion de variables de ambiente, de php, services, hosts ,etc, hay que hacer lo siguiente: Variables de ambiente: PROFILE /etc/profile Editalo y agrega las lineas: INFORMIXDIR=/opt/IBM/informix export INFORMIXDIR PATH=$PATH:$INFORMIXDIR/bin export PATH PDO.INI (Ubicado en /etc/php.d/pdo.ini ), ahi definiremos la extension de informix Agregale la siguiente linea: extension=pdo_informix.so SERVICES (Ubicado en /etc/services) Editalo y agrega al final las lineas, estas son ejemplo, agrega las que correspondan a tu configuracion: # Local services aplicaexec 1526/tcp sqlexec2 1527/tcp SQLHOSTS (Ubicado en opt/IBM/informix/etc/sqlhosts) Editalo y agrega la siguiente configuracion: nombredeinstancia onsoctcp ipdetuservidor sqlexec2 nombredeinstancia onsoctcp ipdetuservidor aplicaexec nombredeinstancia, es el nombre de la instancia a la que te conectaras en informix. onsoctcp es el protocolo sqlexec2 es el nombre del servicio en linux (/etc/services) HTTPD Ubicado en (etc/init.d/httpd) Editalo y agrega las siguientes lineas: INFORMIXDIR=/opt/IBM/informix export INFORMIXDIR DB_LOCALE=es_es.8859-1 export DB_LOCALE En mi caso, yo las agregue al final, pero no las reconocia, luego las cambie entre las primeras lineas y ya me las reconocio perfectamente.

VERIFICACION DE CONFIGURACION Vamos a verificar que se haya cargado el modulo pdo_informix para ello puedes crear un archivo con el siguiente contenido: nano configuracion.php phpinfo(); ?> Ejecutalo desde un navegador y busca la seccion de PDO, debe aparecer asi : PDO drivers => informix, mysql, odbc, sqlite pdo_informix pdo_informix support => enabled En la seccion de Environment, debe de aparecerte la variable de ambiente INFORMIXDIR, ASI: Seccion de Environment Te debe mostrar la variable de ambiente de INFORMIXDIR INFORMIXDIR => /opt/IBM/informix Esta info fue obtenida con phpinfo(); Si todo esto te aparece, entonces significa que ya esta instaldo tu modulo de pdo_informix y ya puedes conectarte con php. THROUBLESHOOTING Por ultimo, toma en cuenta esto, ya que si no logra conectarte, comunmente te marcara el error: Example 5-20 INFORMIXDIR environment variable not set /usr/local/bin/php pdoconnect.php Error!: SQLSTATE=HY000, SQLDriverConnect: -23101 [Informix][Informix ODBC Driver][Informix]Unspecified System Error = -23101. Este error se debe a diferencias en tu configuracion, toma en cuenta el siguiente texto: Troubleshooting The ifx_* function set also relies on the correct settings in environment variables and the configuration file for Informix SDK, so there are several sources for problems in the first attempt to connect to the Informix IDS database server. We list some of the most common mistakes causing connectivity problems. You may notice that the error message shows twice in the output of our examples. The first message comes from the connect function for which we did not disable the error display. The second one is from the error caption. For a detailed discussion about error management, refer to Section 5.2.7, Error handling on page 311. Environment variables for Informix products are necessary to enable the client to find the database server. Example 5-23 and Example 5-24 show the error messages when the environment for the client is set improperly. Here we used

the PHP command line utility to generate the output. The browser would generate similar results. Example 5-23 Missing INFORMIXDIR in the Apache environment /usr/local/bin/php ifxconnect.php Warning: ifx_connect(): E [SQLSTATE=IX 001 SQLCODE=-1829] in /usr/local/apache2/htdocs/ifxconnect.php on line 3 Example 5-24 Missing INFORMIXSERVER in the Apache environment /usr/local/bin/php ifxconnect.php Warning: ifx_connect(): E [SQLSTATE=IX 000 SQLCODE=-25560] in /usr/local/apache2/htdocs/ifx/connect/ifxconnect.php on line 3
Connect: Returncode E [SQLSTATE=IX 000 SQLCODE=-25560] -- Environment variable INFORMIXSERVER must be set.

After setting the right environment variables, we have to take into account that we are working in a client server architecture. So the user running the PHP script has to be authenticated at the database server machine for using the server. In Example 5-25, the connection is attempting to connect with the wrong password, which will certainly generate an error message. Example 5-25 User connection password is wrong /usr/local/bin/php ifxconnect.php Warning: ifx_connect(): E [SQLSTATE=IX 000 SQLCODE=-952] in /usr/local/apache2/htdocs/ifx/connect/ifxconnect.php on line 3
Connect: Returncode E [SQLSTATE=IX 000 SQLCODE=-952] -- User (informix@lead.itsosj.sanjose.ibm.com)'s password is not correct for the database server.

Verify the following if all necessary Informix environment variables set in the Apache environment are verified with phpinfo() and you still receive an error message as shown below: /usr/local/bin/php ifxconnect.php /usr/local/bin/php: error while loading shared libraries: libifsql.so: cannot open shared object file: No such file or directory 1. Does the library exist? If not, check the installation. 2. Does the user informix has the authority to run /usr/local/bin/php ? If not, check permissions in the installation directory. 3. Are there other users getting similar errors such as this? In this case, check the permissions of the installation path. One of the directories above the SDK installation directory may not have read permissions for public. A typical scenario is the installation in the home directory of the informix user in Red Hat. The home directories have rwx------ as default permissions.

Bibliografia :

http://www.ibm.com/developerworks/db2/library/techarticle/dm-0606bombardier/ Developing PHP Applications for IBM Data Servers, en la pagina 235. (RedBooks, lo puedes conseguir en la pagina de IBM o en algun lugar de internet).
(Libro)

You might also like