Forked from Yukibashiri/install_oci8_ubuntu_18.04_php7.2.md
Last active
October 13, 2023 10:16
-
-
Save syahzul/41fb57bd5aa3ba9b2eb00b264d53843c to your computer and use it in GitHub Desktop.
Revisions
-
syahzul revised this gist
Dec 3, 2019 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,6 @@ apt install php7.3-curl php7.3-gd php7.3-mysql php7.3-mbstring php7.3-cli php7.3 ### Step 2 Download the Oracle Instant Client and SDK from Oracle website. [https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html](https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html) -
syahzul revised this gist
Dec 2, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # How to install OCI8 on Linux Mint 19.2 and PHP 7.3 Sources: - http://www.syahzul.com/2016/04/06/how-to-install-oci8-on-ubuntu-14-04-and-php-5-6/ - https://medium.com/@kabeza/setup-oracle-instant-client-with-apache-and-php-7-on-ubuntu-server-17-04-66cea2297d6f -
syahzul revised this gist
Dec 2, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Sources: ## Upgrade or install PHP 7.3 ### Step 1 Add [Ondřej Surý PHP PPA](https://launchpad.net/~ondrej/+archive/ubuntu/php) ``` sudo add-apt-repository ppa:ondrej/php -
syahzul revised this gist
Dec 2, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Sources: ## Upgrade or install PHP 7.3 ### Step 1 Add [Ondřej Surý PPA for PHP 7.3](https://launchpad.net/~ondrej/+archive/ubuntu/php) ``` sudo add-apt-repository ppa:ondrej/php -
syahzul revised this gist
Dec 2, 2019 . 1 changed file with 14 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,7 +76,7 @@ To install the OCI8 extension, we need to install some additional package on our Run these command: ``` apt install php-dev php-pear build-essential libaio1 ``` ### Step 2 @@ -147,4 +147,17 @@ Restart the PHP-FPM systemctl restart php7.3-fpm.service ``` ### Test it out! Create a file containing the following codes. ``` if (function_exists('oci_connect')) { echo 'OCI8 is working!'; } else { echo 'Whoopss...not working!'; } ``` Now you can connect to Oracle DBMS from your PHP applications. -
syahzul revised this gist
Dec 1, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -53,7 +53,7 @@ Add the folder to our `ldconfig`. ``` sudo -s echo /opt/oracle/instantclient_19_5 > /etc/ld.so.conf.d/oracle-instantclient.conf ``` ### Step 6 -
syahzul revised this gist
Dec 1, 2019 . 1 changed file with 5 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,9 @@ # How to install OCI8 on Linux Mint 19.2 and PHP 7.2 Sources: - http://www.syahzul.com/2016/04/06/how-to-install-oci8-on-ubuntu-14-04-and-php-5-6/ - https://medium.com/@kabeza/setup-oracle-instant-client-with-apache-and-php-7-on-ubuntu-server-17-04-66cea2297d6f - https://gist.github.com/hewerthomn/81eea2935051eb2500941a9309bca703#file-install_oci8_ubuntu_16-04_php7-1-md - https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e ## Upgrade or install PHP 7.3 ### Step 1 -
syahzul revised this gist
Dec 1, 2019 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,12 @@ # How to install OCI8 on Linux Mint 19.2 and PHP 7.2 Source: http://www.syahzul.com/2016/04/06/how-to-install-oci8-on-ubuntu-14-04-and-php-5-6/ Source: https://medium.com/@kabeza/setup-oracle-instant-client-with-apache-and-php-7-on-ubuntu-server-17-04-66cea2297d6f Source: https://gist.github.com/hewerthomn/81eea2935051eb2500941a9309bca703#file-install_oci8_ubuntu_16-04_php7-1-md Source: https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e ## Upgrade or install PHP 7.3 ### Step 1 Add Ondrej Sury PPA for PHP 7.3 -
syahzul renamed this gist
Dec 1, 2019 . 1 changed file with 29 additions and 28 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,31 +1,41 @@ # How to install OCI8 on Linux Mint 19.2 and PHP 7.2 Source: http://www.syahzul.com/2016/04/06/how-to-install-oci8-on-ubuntu-14-04-and-php-5-6/ Source: https://medium.com/@kabeza/setup-oracle-instant-client-with-apache-and-php-7-on-ubuntu-server-17-04-66cea2297d6f Source: https://gist.github.com/hewerthomn/81eea2935051eb2500941a9309bca703#file-install_oci8_ubuntu_16-04_php7-1-md ## Upgrade or install PHP 7.3 ### Step 1 Add Ondrej Sury PPA for PHP 7.3 ``` sudo add-apt-repository ppa:ondrej/php apt update && apt upgrade apt install php7.3-curl php7.3-gd php7.3-mysql php7.3-mbstring php7.3-cli php7.3-xml php7.3-zip ``` ## Install Oracle Instant Client and SDK ### Step 2 Download the Oracle Instant Client and SDK from Oracle website. (Need to login in Oracle page) [https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html](https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html) Files: `instantclient-basic-linux.x64-19.5.0.0.0dbru.zip` and `instantclient-sdk-linux.x64-19.5.0.0.0dbru.zip`. ### Step 3 Create a new folder to store Oracle Instant Client zip files on your server. Upload the Instant Clients files inside this folder. ``` sudo mkdir /opt/oracle ``` ### Step 4 Now we need to extract the files. @@ -35,21 +45,13 @@ unzip instantclient-basic-linux.x64-12.2.0.1.0.zip unzip instantclient-sdk-linux.x64-12.2.0.1.0.zip ``` ### Step 5 Add the folder to our `ldconfig`. ``` sudo -s echo /opt/oracle/instantclient_19_5 > /etc/ld.so.conf.d/oracle-instantclient ``` ### Step 6 @@ -94,27 +96,26 @@ pecl install oci8 When you are prompted for the Instant Client location, enter the following: ``` instantclient,/opt/oracle/instantclient_19_5 ``` ### Step 3 We need to tell PHP to load the OCI8 extension. ``` echo "extension = oci8.so" >> /etc/php/7.3/fpm/php.ini echo "extension = oci8.so" >> /etc/php/7.3/cli/php.ini echo "extension = oci8.so" >> /etc/php/7.3/apache2/php.ini ``` We also need to add on apache those environment variables. ``` echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_5" >> /etc/apache2/envvars echo "export ORACLE_HOME=/opt/oracle/instantclient_19_5" >> /etc/apache2/envvars echo "LD_LIBRARY_PATH=/opt/oracle/instantclient_19_5:$LD_LIBRARY_PATH" >> /etc/environment ``` ### Step 4 @@ -141,7 +142,7 @@ If returns `oci8`, its works! Restart the PHP-FPM ``` systemctl restart php7.3-fpm.service ``` Now you can connect to Oracle DBMS from your PHP applications. -
Yukibashiri revised this gist
Oct 19, 2018 . 1 changed file with 14 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -102,9 +102,9 @@ instantclient,/opt/oracle/instantclient_12_2 We need to tell PHP to load the OCI8 extension. ``` echo "extension =oci8.so" >> /etc/php/7.2/fpm/php.ini echo "extension =oci8.so" >> /etc/php/7.2/cli/php.ini echo "extension =oci8.so" >> /etc/php/7.2/apache2/php.ini ``` @@ -113,10 +113,21 @@ We also need to add on apache those environment variables. ``` echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2" >> /etc/apache2/envvars echo "export ORACLE_HOME=/opt/oracle/instantclient_12_2" >> /etc/apache2/envvars echo "LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH" >> /etc/environment ``` ### Step 4 Refresh the server. If you are accessing through SSH, then ``` exit ``` or ``` sudo shutdown -r now ``` Check if the extension is enabled. ``` -
Yukibashiri revised this gist
Oct 19, 2018 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -108,6 +108,13 @@ echo "extension = /usr/lib/php/20170718/oci8.so" >> /etc/php/7.2/apache2/php.ini ``` We also need to add on apache those environment variables. ``` echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2" >> /etc/apache2/envvars echo "export ORACLE_HOME=/opt/oracle/instantclient_12_2" >> /etc/apache2/envvars ``` ### Step 4 Check if the extension is enabled. -
Yukibashiri revised this gist
Oct 19, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ # How to install OCI8 on Ubuntu 18.04 and PHP 7.2 Source: http://www.syahzul.com/2016/04/06/how-to-install-oci8-on-ubuntu-14-04-and-php-5-6/ Source: https://medium.com/@kabeza/setup-oracle-instant-client-with-apache-and-php-7-on-ubuntu-server-17-04-66cea2297d6f Source: https://gist.github.com/hewerthomn/81eea2935051eb2500941a9309bca703#file-install_oci8_ubuntu_16-04_php7-1-md ## Install Oracle Instant Client and SDK -
Yukibashiri renamed this gist
Oct 19, 2018 . 1 changed file with 21 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ # How to install OCI8 on Ubuntu 18.04 and PHP 7.2 Source: http://www.syahzul.com/2016/04/06/how-to-install-oci8-on-ubuntu-14-04-and-php-5-6/ Source: https://medium.com/@kabeza/setup-oracle-instant-client-with-apache-and-php-7-on-ubuntu-server-17-04-66cea2297d6f Source: https://gist.github.com/hewerthomn/81eea2935051eb2500941a9309bca703#file-install_oci8_ubuntu_16-04_php7-1-md ## Install Oracle Instant Client and SDK ### Step 1 @@ -9,7 +11,7 @@ Download the Oracle Instant Client and SDK from Oracle website. [http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html](http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html) Files: `instantclient-basic-linux.x64-12.2.0.1.0.zip` and `instantclient-sdk-linux.x64-12.2.0.1.0.zip`. ### Step 2 @@ -27,25 +29,25 @@ Now we need to extract the files. ``` cd /opt/oracle unzip instantclient-basic-linux.x64-12.2.0.1.0.zip unzip instantclient-sdk-linux.x64-12.2.0.1.0.zip ``` ### Step 4 Next, we need to create a symlink to Instant Client files. ``` ln -s /opt/oracle/instantclient_12_2/libclntsh.so.12.1 /opt/oracle/instantclient_12_2/libclntsh.so ln -s /opt/oracle/instantclient_12_2/libocci.so.12.1 /opt/oracle/instantclient_12_2/libocci.so ``` ### Step 5 Add the folder to our `ldconfig`. ``` echo /opt/oracle/instantclient_12_2 > /etc/ld.so.conf.d/oracle-instantclient ``` ### Step 6 @@ -74,7 +76,13 @@ apt-get install php-dev php-pear build-essential libaio1 ### Step 2 Once installed, we need to get the OCI8 file. But, before that we need to update PECL channel. ``` pecl channel-update pecl.php.net ``` Then. ``` pecl install oci8 @@ -84,16 +92,18 @@ pecl install oci8 When you are prompted for the Instant Client location, enter the following: ``` instantclient,/opt/oracle/instantclient_12_2 ``` ### Step 3 We need to tell PHP to load the OCI8 extension. ``` echo "extension = /usr/lib/php/20170718/oci8.so" >> /etc/php/7.2/fpm/php.ini echo "extension = /usr/lib/php/20170718/oci8.so" >> /etc/php/7.2/cli/php.ini echo "extension = /usr/lib/php/20170718/oci8.so" >> /etc/php/7.2/apache2/php.ini ``` ### Step 4 @@ -111,7 +121,7 @@ If returns `oci8`, its works! Restart the PHP-FPM ``` service php7.2-fpm restart ``` Now you can connect to Oracle DBMS from your PHP applications. -
hewerthomn created this gist
Feb 22, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,117 @@ # How to install OCI8 on Ubuntu 16.04 and PHP 7.1 Source: http://www.syahzul.com/2016/04/06/how-to-install-oci8-on-ubuntu-14-04-and-php-5-6/ ## Install Oracle Instant Client and SDK ### Step 1 Download the Oracle Instant Client and SDK from Oracle website. (Need to login in Oracle page) [http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html](http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html) Files: `instantclient-basic-linux.x64-12.1.0.2.0.zip` and `instantclient-sdk-linux.x64-12.1.0.2.0.zip`. ### Step 2 Create a new folder to store Oracle Instant Client zip files on your server. Upload the Instant Clients files inside this folder. ``` mkdir /opt/oracle ``` ### Step 3 Now we need to extract the files. ``` cd /opt/oracle unzip instantclient-basic-linux.x64-12.1.0.2.0.zip unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip ``` ### Step 4 Next, we need to create a symlink to Instant Client files. ``` ln -s /opt/oracle/instantclient_12_1/libclntsh.so.12.1 /opt/oracle/instantclient_12_1/libclntsh.so ln -s /opt/oracle/instantclient_12_1/libocci.so.12.1 /opt/oracle/instantclient_12_1/libocci.so ``` ### Step 5 Add the folder to our `ldconfig`. ``` echo /opt/oracle/instantclient_12_1 > /etc/ld.so.conf.d/oracle-instantclient ``` ### Step 6 Update the Dynamic Linker Run-Time Bindings ``` ldconfig ``` Done. Now we can proceed to the next part. ## Install Additional Packages To install the OCI8 extension, we need to install some additional package on our server. ### Step 1 Run these command: ``` apt-get install php-dev php-pear build-essential libaio1 ``` ### Step 2 Once installed, we need to get the OCI8 file. ``` pecl install oci8 ``` When you are prompted for the Instant Client location, enter the following: ``` instantclient,/opt/oracle/instantclient_12_1 ``` ### Step 3 We need to tell PHP to load the OCI8 extension. ``` echo "extension = oci8.so" >> /etc/php/7.1/fpm/php.ini echo "extension = oci8.so" >> /etc/php/7.1/cli/php.ini ``` ### Step 4 Check if the extension is enabled. ``` php -m | grep 'oci8' ``` If returns `oci8`, its works! ### Step 5 Restart the PHP-FPM ``` service php7.1-fpm restart ``` Now you can connect to Oracle DBMS from your PHP applications.