Blog Archives

Install OCI8 for PHP

rpm -ivh oracle-instantclient-basic-linux.XXX.rpm 
rpm -ivh oracle-instantclient-devel-linux.XXX.rpm

yum install php-pear php-devel zlib zlib-devel bc libaio glibc
yum groupinstall "Development Tools"

ln -s /usr/include/oracle/XXX/client64 /usr/include/oracle/XXX/client
ln -s /usr/lib/oracle/XXX/client64 /usr/lib/oracle/XXX/client
mkdir /opt/iclient

Create a file inside /etc/profile.d named oracle.sh and put this as the content:

export LD_LIBRARY_PATH=/usr/lib/oracle/XXX/client64/lib:${LD_LIBRARY_PATH}
export TNS_ADMIN=/opt/iclient
export NLS_LANG=GERMAN_GERMANY.UTF8
export SQLPATH=/usr/lib/oracle/XXX/client64/lib:${SQLPATH}

And run it so we’ll have LD_LIBRARY_PATH as an environment variable.

source /etc/profile.d/oracle.sh

Use ‘oci8’ to install for PHP 8.
Use ‘oci8-2.2.0’ to install for PHP7
Use ‘oci8-2.0.12’ to install for PHP 5.2 – PHP 5.6.
Use ‘oci8-1.4.10’ to install for PHP 4.3.9 – PHP 5.1.
The OCI8 extension can be linked with Oracle client libraries from Oracle Database 19.9, 12.2, 12.1, 11, or 10.2.

pear download pecl/oci8-2.0.12 
tar -xvf oci8-2.0.12.tgz
cd oci8-2.0.12

phpize ./configure --with-oci8=shared,instantclient,/usr/lib/oracle/XXX/client64/lib
./configure --with-oci8=shared,instantclient,/usr/lib/oracle/XXX/client64/lib
make
make install

If you run into such an error:

error: oci8_dtrace_gen.h: No such file or directory

try to solve it with Stackoverflow:26145605.
To enable the extension, add a file named oci8.ini in /etc/php.d with this content:

extension=oci8.so

Restart Apache Webserver.

Copy your tnsnames.ora and sqlnet.ora to /opt/iclient.

Code Formatter Eclipse PDT

You can download a cool extension from http://sourceforge.jp/users/atlanto/pf/eclipse/files/ which allows you to define the code format for your PHP code. Install the .zip-file as archive with Eclipse’s “Install New Software…” feature.