We will prepare for

if you dont upgraded to php 7 you can use viveks debian 8 jessie php 7 tutorial;

quick excerpt:

#purge php 5
x="$(dpkg --list | grep php | awk '/^ii/{ print $2}')"
sudo apt-get --purge remove $x

#add dotdeb php7.0 repo
$ sudo -s
# echo ‘deb http://packages.dotdeb.org jessie all’ >> /etc/apt/sources.list
# echo ‘deb-src http://packages.dotdeb.org jessie all’ >> /etc/apt/sources.list

$ cd /tmp
$ wget https://www.dotdeb.org/dotdeb.gpg
$ sudo apt-key add dotdeb.gpg
$ rm dotdeb.gpg

sudo apt-get update

apt-get install libapache2-mod-php7.0 php-pear php7.0 php7.0-cgi php7.0-cli php7.0-common php7.0-fpm php7.0-gd php7.0-json php7.0-mysql php7.0-readline php7.0-mbstring php7.0-mcrypt

download oracle instantclient

and convert it into debian package with alien;

sudo alien -d oracle-instantclient12.2-basic-
sudo alien -d oracle-instantclient12.2-devel-

sudo dpkg -i oracle-instantclient12.2-basic_12.
sudo dpkg -i oracle-instantclient12.2-devel_12.

export ORACLE_HOME=/usr/lib/oracle/12.2/client64
export C_INCLUDE_PATH=/usr/lib/oracle/12.2/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib

pecl install oci8

Command will ask library location, enter the line below;



prepare compiling php;

sudo apt-get install gcc make apache2-dev libaio1 libmcrypt-dev

wget http://php.net/distributions/php-7.1.2.tar.bz2
tar xvf php-7.1.2.tar.bz2
cd php-7.1.2

configure with common options;
./configure –with-pdo-oci –with-oci8 –with-apxs2=/usr/bin/apxs2 –with-gd –with-pdo-mysql –with-gettext –with-kerberos –enable-mbstring –with-mcrypt –with-openssl –enable-soap –enable-sockets –enable-sysvmsg –enable-wddx –enable-zip –with-zlib

now we need to configure php ;
sudo vim /etc/php/7.0/apache2/php.ini  #you can check php.ini location from phpinfo();
change line
;include_path = “.:/usr/share/php” =>  include_path = “.:/usr/share/php:/usr/local/lib/php”

extension_dir = “/usr/lib/php/20151012” #if u dont know path check with “locate oci8.so” command
date.timezone = Europe/Istanbul


and now we need to restart webserver;

sudo service apache2 restart