debian: php oracle-ntzako pdo modulue instala

Bueno ba goiz guztidxe ogon dast hau popatik emoten baie azkanien atara dot, guzan ba:

1.go gauzie okinbidena kontuten, non dakozuien oracle instalata, dana dala hau post-a elegante etorko datzuie: php + oci8 Oracle bezero (kliente) moduen imintzeko gnu/linux-en

Neure kasuen: /opt/oracle-instantclient-11-2 karpetan dakot dana.

ls -l /opt/oracle-instantclient-11-2

-rwxr-xr-x 1 zital zital    25588 abu 15  2009 adrci
-rw-r--r-- 1 zital zital      439 abu 15  2009 BASIC_README
-rwxr-xr-x 1 zital zital    44963 abu 15  2009 genezi
-r--r--r-- 1 zital zital      342 abu 15  2009 glogin.sql
-rwxr-xr-x 1 zital zital 48797739 abu 15  2009 libclntsh.so
lrwxrwxrwx 1 zital zital       12 abe  2 10:47 libclntsh.so.11.1 -> libclntsh.so
-r-xr-xr-x 1 zital zital  7899997 abu 15  2009 libnnz11.so
-rwxr-xr-x 1 zital zital  1261302 abu 15  2009 libocci.so.11.1
-rwxr-xr-x 1 zital zital 89382994 abu 15  2009 libociei.so
-r-xr-xr-x 1 zital zital   165157 abu 15  2009 libocijdbc11.so
-r-xr-xr-x 1 zital zital  1504295 abu 15  2009 libsqlplusic.so
-r-xr-xr-x 1 zital zital  1470768 abu 15  2009 libsqlplus.so
-rw-r--r-- 1 zital zital   472664 urt 14  2010 oci8.so
-r--r--r-- 1 zital zital  1996228 abu 15  2009 ojdbc5.jar
-r--r--r-- 1 zital zital  2111220 abu 15  2009 ojdbc6.jar
drwxr-xr-x 4 zital zital     4096 abu 15  2009 sdk
-r-xr-xr-x 1 zital zital     9320 abu 15  2009 sqlplus
-rw-r--r-- 1 zital zital      443 abu 15  2009 SQLPLUS_README
-rw-r--r-- 1 zital zital     8220 abe  2 11:09 tnsnames.ora
-rw-r--r-- 1 iban iban    37807 abu 15  2009 xstreams.jar
ls -l /opt/oracle-instantclient-11-2/sdk/include

-r-xr-xr-x 1 zital zital  42534 abu 15  2009 ldap.h
-r--r--r-- 1 zital zital  34157 abu 15  2009 nzerror.h
-r--r--r-- 1 zital zital  74787 abu 15  2009 nzt.h
-r--r--r-- 1 zital zital  11586 abu 15  2009 occiAQ.h
-r--r--r-- 1 zital zital  34750 abu 15  2009 occiCommon.h
-r--r--r-- 1 zital zital  70685 abu 15  2009 occiControl.h
-r--r--r-- 1 zital zital  39751 abu 15  2009 occiData.h
-r--r--r-- 1 zital zital   2115 abu 15  2009 occi.h
-r--r--r-- 1 zital zital  24778 abu 15  2009 occiObjects.h
-r-xr-xr-x 1 zital zital   7203 abu 15  2009 oci1.h
-r--r--r-- 1 zital zital  10361 abu 15  2009 oci8dp.h
-r--r--r-- 1 zital zital 431290 abu 15  2009 ociap.h
-r-xr-xr-x 1 zital zital   6204 abu 15  2009 ociapr.h
-r--r--r-- 1 zital zital  43001 abu 15  2009 ocidef.h
-r-xr-xr-x 1 zital zital   4048 abu 15  2009 ocidem.h
-r--r--r-- 1 zital zital  11339 abu 15  2009 ocidfn.h
-r--r--r-- 1 zital zital   8953 abu 15  2009 ociextp.h
-r--r--r-- 1 zital zital 170958 abu 15  2009 oci.h
-r-xr-xr-x 1 zital zital   6494 abu 15  2009 ocikpr.h
-r--r--r-- 1 zital zital   4670 abu 15  2009 ocixmldb.h
-r--r--r-- 1 zital zital  94528 abu 15  2009 ocixstream.h
-r--r--r-- 1 zital zital  23266 abu 15  2009 odci.h
-r-xr-xr-x 1 zital zital   6540 abu 15  2009 oratypes.h
-r--r--r-- 1 zital zital  15083 abu 15  2009 orid.h
-r--r--r-- 1 zital zital 102775 abu 15  2009 ori.h
-r--r--r-- 1 zital zital 157901 abu 15  2009 orl.h
-r--r--r-- 1 zital zital  42626 abu 15  2009 oro.h
-r--r--r-- 1 zital zital 116645 abu 15  2009 ort.h
-r-xr-xr-x 1 zital zital   9892 abu 15  2009 xa.h

Zeuok jakitzeko zer koño dakoten karpetan barruen ;)

Abante!!!

su
cd /usr/src
pecl download pdo_oci
tar -zxvf PDO_OCI-1.0.tgz
cd PDO_OCI-1.0
phpize

Nahiz eta 11.2 okin, 10.2-rarte dau preparata konpileteko script-e, orduen haulan ezango lekide konpilaziñoko katie:

./configure --with-pdo-oci=instantclient,/opt/oracle-instantclient-11-2,10.2

ERROR!!!!

"checking for oci.h... configure: error: I'm too dumb to figure out where the include dir is in your instant client install"

Bueno hasi gara, config.m4 edite biherku:

nano config.m4

topa hau katie:

nl $Id: config.m4,v 1.14.2.1 2005/09/24 23:23:24 sniper Exp $

if test "$PHP_PDO" != "no"; then

eta haunegaizik aldatu:

nl $Id: config.m4,v 1.14.2.1 2005/09/24 23:23:24 sniper Exp $

Z_INCLUDE=/opt/oracle-instantclient-11-2/sdk/include

if test "$PHP_PDO" != "no"; then

eta beste hau be topa:

  if test "instantclient" = "`echo $PDO_OCI_DIR | cut -d, -f1`" ; then
    PDO_OCI_IC_PREFIX="`echo $PDO_OCI_DIR | cut -d, -f2`"
    PDO_OCI_IC_VERS="`echo $PDO_OCI_DIR | cut -d, -f3`"
    AC_MSG_CHECKING([for oci.h])
    if test -f $PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client/oci.h ; then
      PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client)
      AC_MSG_RESULT($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client)
    elif test -f $PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include/oci.h ; then
      PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
      AC_MSG_RESULT($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
    elif test -f $PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include/oci.h ; then
      PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
      AC_MSG_RESULT($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
    else
      AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your instant client install])
    fi

eta haunegaitzik aldatu:

  if test "instantclient" = "`echo $PDO_OCI_DIR | cut -d, -f1`" ; then
    PDO_OCI_IC_PREFIX="`echo $PDO_OCI_DIR | cut -d, -f2`"
    PDO_OCI_IC_VERS="`echo $PDO_OCI_DIR | cut -d, -f3`"
    AC_MSG_CHECKING([for oci.h])
    if test -f $PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client/oci.h ; then
      PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client)
      AC_MSG_RESULT($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client)
    elif test -f $PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include/oci.h ; then
      PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
      AC_MSG_RESULT($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
    elif test -f $PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include/oci.h ; then
      PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
      AC_MSG_RESULT($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
    elif test -f $Z_INCLUDE/oci.h ; then
      PHP_ADD_INCLUDE($Z_INCLUDE)
      AC_MSG_RESULT($Z_INCLUDE)
    else
      AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your instant client install])
    fi

bueno barriro intenta’ku:

phpize
./configure --with-pdo-oci=instantclient,/opt/oracle-instantclient-11-2,10.2

ERROR!!!!

"configure: error: Cannot find php_pdo_driver.h."

Konponduteko:

find / | grep php_pdo_driver.h

erantzune-n adibidie:

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

konpilaziñoko fitxerue aldatu’ku: configure

nano configure

hau topa:

    if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
      pdo_inc_path=$abs_srcdir/ext
    elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
      pdo_inc_path=$abs_srcdir/ext
    elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
      pdo_inc_path=$prefix/include/php/ext
    fi

eta haunegaitzik aldatu:

    if test -f /usr/include/php5/ext/pdo/php_pdo_driver.h; then
      pdo_inc_path=/usr/include/php5/ext/pdo
    elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
      pdo_inc_path=$abs_srcdir/ext
    elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
      pdo_inc_path=$prefix/include/php/ext
    fi

ia barriro intenta’ku ia…

./configure --with-pdo-oci=instantclient,/opt/oracle-instantclient-11-2,10.2

ERROR!!!!!

/usr/bin/ld: cannot find -lclntsh

ia konponduteko:

find / | grep libclntsh.so

erantzune-n adibidie:

/usr/local/lib/libclntsh.so.11.1
/usr/lib/libclntsh.so.11.1

konponduteko enlaze sinbolikuek sortu’kuz:

ln -s /usr/local/lib/libclntsh.so.11.1 /usr/local/lib/libclntsh.so
ln -s /usr/lib/libclntsh.so.11.1 /usr/lib/libclntsh.so

eta barriro intenta:

./configure --with-pdo-oci=instantclient,/opt/oracle-instantclient-11-2,10.2

Ondo in badauen:

make clean
make
make install
echo "extension=pdo_oci.so" > /etc/php5/conf.d/pdo_oci.ini
/etc/init.d/apache2 restart

Probateko kodigue:

<?php
$tns = " 
(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = EITBCOM)
    )
  )
       ";
$db_username = 'USER';
$db_password = 'PASSWD';
try
{
    $conn = new PDO("oci:dbname=".$tns, $db_username, $db_password);
	echo 'yeah';
}
catch(PDOException $e)
{
    echo ($e->getMessage());
}
?>

Utzi erantzuna

Zure e-posta helbidea ez da argitaratuko. Beharrezko eremuak * markatuta daude