instalar pdo informix en linux(centos)

Download Instalar PDO INFORMIX en Linux(Centos)

If you can't read please download the document

Upload: viktor-gomez

Post on 29-Nov-2015

756 views

Category:

Documents


4 download

TRANSCRIPT

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 descargaDebes 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_INFORMIX-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 protocolosqlexec2 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 INFORMIXDIRDB_LOCALE=es_es.8859-1 export DB_LOCALEEn 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 CONFIGURACIONVamos 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.phpError!: 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:

TroubleshootingThe ifx_* function set also relies on the correct settings in environment variablesand the configuration file for Informix SDK, so there are several sources forproblems in the first attempt to connect to the Informix IDS database server. Welist some of the most common mistakes causing connectivity problems. You maynotice that the error message shows twice in the output of our examples. Thefirst message comes from the connect function for which we did not disable theerror display. The second one is from the error caption. For a detailed discussionabout error management, refer to Section 5.2.7, Error handling on page 311.Environment variables for Informix products are necessary to enable the client tofind the database server. Example 5-23 and Example 5-24 show the errormessages when the environment for the client is set improperly. Here we usedthe PHP command line utility to generate the output. The browser wouldgenerate similar results.Example 5-23 Missing INFORMIXDIR in the Apache environment/usr/local/bin/php ifxconnect.phpWarning: ifx_connect(): E [SQLSTATE=IX 001 SQLCODE=-1829] in/usr/local/apache2/htdocs/ifxconnect.php on line 3Example 5-24 Missing INFORMIXSERVER in the Apache environment/usr/local/bin/php ifxconnect.phpWarning: ifx_connect(): E [SQLSTATE=IX 000 SQLCODE=-25560] in/usr/local/apache2/htdocs/ifx/connect/ifxconnect.php on line 3Connect: Returncode E [SQLSTATE=IX 000 SQLCODE=-25560] -- Environmentvariable INFORMIXSERVER must be set.

After setting the right environment variables, we have to take into account thatwe are working in a client server architecture. So the user running the PHP scripthas to be authenticated at the database server machine for using the server. InExample 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.phpWarning: ifx_connect(): E [SQLSTATE=IX 000 SQLCODE=-952] in/usr/local/apache2/htdocs/ifx/connect/ifxconnect.php on line 3Connect: Returncode E [SQLSTATE=IX 000 SQLCODE=-952] -- User([email protected])'s password is not correct for thedatabase server.

Verify the following if all necessary Informix environment variables set in theApache environment are verified with phpinfo() and you still receive an errormessage 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 directory1. 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 thedirectories above the SDK installation directory may not have readpermissions for public. A typical scenario is the installation in the homedirectory of the informix user in Red Hat. The home directories haverwx------ as default permissions.

Bibliografia :

http://www.ibm.com/developerworks/db2/library/techarticle/dm-0606bombardier/

(Libro) 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).