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-12.2.0.1.0-1.x86_64.rpm
sudo alien -d oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm

sudo dpkg -i oracle-instantclient12.2-basic_12.2.0.1.0-2_amd64.deb
sudo dpkg -i oracle-instantclient12.2-devel_12.2.0.1.0-2_amd64.deb

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;

instantclient,/usr/lib/oracle/12.2/client64/lib

 

prepare compiling php;

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

http://php.net/downloads.php#v7.1.2
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”

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

 

and now we need to restart webserver;

sudo service apache2 restart