Compile o PHP com PDO-OCI e OCI8

De Wiki Hackstore

Oracle instant-client 10.2.0.3-1

Efetue o download do oracle client e instale as versões:

oracle-instantclient-basic-10.2.0.3-1.x86_64.rpm
oracle-instantclient-devel-10.2.0.3-1.x86_64.rpm


Configure as libs do oracle

cd /usr/lib/oracle/10.2.0.3/client64
cp /usr/include/oracle/10.2.0.3/client64/* .
ln -s lib/libnnz10.so libnnz.so
ln -s lib/libclntsh.so.10.1 libclntsh.so
ln -s lib/libnnz10.so libnnz10.so
ln -s lib/libclntsh.so.10.1 libclntsh.so.10.1
cd /usr/lib/oracle/10.2.0.3/client64
mkdir sdk
cd sdk && ln -s /usr/include/oracle/10.2.0.3/client64 include
ln -s /usr/lib/oracle/10.2.0.3/client64/sdk/include/ /usr/lib/oracle/10.2.0.3/client/include
ln -s /usr/lib/oracle/10.2.0.3/client64/ /usr/lib/oracle/10.2.0.3/client
ln -s /usr/include/oracle/10.2.0.3/client64/ /usr/include/oracle/10.2.0.3/client


Configure o PHP

cd /opt ; w3m 'http://php.net/get/php-5.6.33.tar.bz2/from/this/mirror'
tar xjpf php-5.6.33.tar.bz2 
cd  /opt/php-5.6.33 ; ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--datadir=/usr/share/php \
--mandir=/usr/share/man \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-zlib \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-gdbm \
--with-gmp \
--enable-ftp \
--with-gettext \
--enable-mbstring \
--with-readline \
--with-apxs2 \
--with-pdo-oci=instantclient,/usr/lib/oracle/10.2.0.3/client64,10.2.0.3 \
--enable-dba=shared \
--with-pdo-pgsql \
--enable-short-tags \
--with-pear \
--enable-exif \
--enable-pcntl \
--enable-soap \
--enable-sockets \
--enable-wddx \
--enable-zip \
--enable-pdo \
--enable-cgi \
--enable-json \
--with-curl \
--with-openssl \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-pdo-pgsql \
--with-mcrypt \
--with-pgsql \
--with-gd \
--with-jpeg-dir \
--enable-gd-native-ttf \
--with-freetype-dir

Compile o PHP

make && make install

Compile o OCI8 via pecl

pecl install oci8-2.0.12

Quando for solicitado, informe o diretório:

instantclient,/usr/lib/oracle/10.2.0.3/client64

Oracle instant-client 11.2.0.4.0-1

Efetue o download do oracle client e instale as versões:

oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm


Configure o PHP

cd /opt ; w3m 'http://php.net/get/php-5.6.33.tar.bz2/from/this/mirror'
 tar xjpf php-5.6.33.tar.bz2 
cd  /opt/php-5.6.33 ; ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--datadir=/usr/share/php \
--mandir=/usr/share/man \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-zlib \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-gdbm \
--with-gmp \
--enable-ftp \
--with-gettext \
--enable-mbstring \
--with-readline \
--with-apxs2 \
--with-pdo-oci=instantclient,/usr,11.2 \
--enable-dba=shared \
--with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client64/lib \
--with-pdo-pgsql \
--enable-short-tags \
--with-pear \
--enable-exif \
--enable-pcntl \
--enable-soap \
--enable-sockets \
--enable-wddx \
--enable-zip \
--enable-pdo \
--enable-cgi \
--enable-json \
--with-curl \
--with-openssl \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-pdo-pgsql \
--with-mcrypt \
--with-pgsql \
--with-gd \
--with-jpeg-dir \
--enable-gd-native-ttf \
--with-freetype-dir


Compile o PHP

make && make install


Compile o OCI8 via pecl

pecl install oci8-2.0.12

Quando for solicitado, informe o diretório:

instantclient,/usr/lib/oracle/11.2/client64/lib

Configure o apache

echo 'LoadModule php5_module        /usr/lib64/httpd/modules/libphp5.so' >> /etc/httpd/conf/httpd.conf

Crie o arquivo /etc/httpd/conf.d/php5.conf

<IfModule mod_php5.c>
       <FilesMatch "\.ph(p[345]?|tml)$">
           SetHandler application/x-httpd-php
       </FilesMatch>
       <FilesMatch "\.php[345]?s$">
           SetHandler application/x-httpd-php-source
       </FilesMatch>
        DirectoryIndex index.php4
        DirectoryIndex index.php5
        DirectoryIndex index.php
</IfModule>