Skip to content

Instantly share code, notes, and snippets.

@goobeck
Created March 16, 2017 09:21
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save goobeck/490cd39c8ee35d90dc97204758192485 to your computer and use it in GitHub Desktop.
Save goobeck/490cd39c8ee35d90dc97204758192485 to your computer and use it in GitHub Desktop.
Homestead Oracle instant client (oci8, pdo_oci)
#!/bin/bash
sudo apt-get update
sudo apt-get install -y alien wget
mkdir downloads
cd downloads
# official oracle instant client http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
echo 'Downloading oracle instant client basic'
wget -nv https://www.dropbox.com/s/q7fkj3d1hn2scrl/oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
echo 'download oracle instant client devel'
wget -nv https://www.dropbox.com/s/qjwbk0agc1rqxob/oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
echo 'Install oracle instant basic'
sudo alien -i oracle-instantclient*-basic-*.rpm
echo 'Install oracle instant devel'
sudo alien -i oracle-instantclient*-devel-*.rpm
# It installed to:
# /usr/lib/oracle/12.1/client64
# /usr/lib/oracle/12.1/client64/lib
sudo sh -c 'echo "env[ORACLE_HOME] = /usr/lib/oracle/12.1/client64" >> /etc/php/7.1/fpm/pool.d/www.conf'
sudo sh -c 'echo "env[LD_LIBRARY_PATH] = /usr/lib/oracle/12.1/client64/lib" >> /etc/php/7.1/fpm/pool.d/www.conf'
sudo service php7.1-fpm restart
echo 'install oci8'
printf "\n" | sudo pecl install oci8
echo 'add oci8 extension to php.ini'
sudo sh -c 'echo "extension=oci8.so" >> /etc/php/7.1/fpm/php.ini'
sudo service php7.1-fpm restart
echo 'install pdo oci'
wget -nv http://th1.php.net/distributions/php-7.1.2.tar.gz
tar xzf php-7.1.2.tar.gz
cd php-7.1.2/ext/pdo_oci
sudo phpize
sudo ./configure --with-pdo-oci=instantclient,/usr,12.1
sudo make
sudo make install
echo 'add pdo oci extension to php.ini'
sudo sh -c 'echo "extension=pdo_oci.so" >> /etc/php/7.1/fpm/php.ini'
sudo service php7.1-fpm restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment