Skip to content

Instantly share code, notes, and snippets.

@ebta
Last active June 18, 2020 14:45
Show Gist options
  • Save ebta/8d1e08b1c01b5e58052a4a1d032202aa to your computer and use it in GitHub Desktop.
Save ebta/8d1e08b1c01b5e58052a4a1d032202aa to your computer and use it in GitHub Desktop.
Install PDO_OCI PHP 7.2 Ubuntu 18.04
# First, install oci8 using instalclient, for example look at this
# https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e
# download php source code
wget https://www.php.net/distributions/php-7.2.28.tar.gz
# wget https://www.php.net/distributions/php-7.4.7.tar.gz
# extract
tar -xzf php-7.2.28.tar.gz
# Go to directory PHP
cd /php-7.2.28/ext/pdo_oci
# Run in order
phpize
# Use --with-pdo-oci=instantclient,prefix,version
# prefix = location instantclient, ex: /opt/oracle/instantclient
./configure --with-pdo-oci=instantclient,/opt/oracle/instantclient,12.1
make && make install
# If this is not runtime php directory, copy ti extension dir
cp modules/pdo_oci.so /php-7.2.28/ext/pdo_oci/modules
# Optional if extention not automatically added
echo "extension=pdo_oci.so" > /etc/php.d/pdo_oci.ini
# OR add create add "extension=pdo_oci.so" inside ( without double quote )
# /etc/php/7.2/mods-available/pdo_oci.ini
# create symlink
sudo ln -s /etc/php/7.2/mods-available/pdo_oci.ini ./20-pdo_oci.ini
# restart apache/httpd
service httpd restart
# php-fpm
sudo systemctl restart php7.2-fpm.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment