Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save syahzul/8f29a34a45c62fc577f7964ba123d4ba to your computer and use it in GitHub Desktop.
Save syahzul/8f29a34a45c62fc577f7964ba123d4ba to your computer and use it in GitHub Desktop.

Revisions

  1. syahzul revised this gist Dec 1, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions How-To-Install-OCI8-on-RunCloud-Ubuntu-20.04.md
    Original file line number Diff line number Diff line change
    @@ -130,5 +130,6 @@ Test it on your web browser.

    ## References

    - [https://runcloud.io/docs/guide/cheat-sheet/php#installing-custom-php-modules](https://runcloud.io/docs/guide/cheat-sheet/php#installing-custom-php-modules)
    - [https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e](https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e)
    - [https://www.php.net/manual/en/oci8.installation.php](https://www.php.net/manual/en/oci8.installation.php)
  2. syahzul revised this gist Dec 1, 2020. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion How-To-Install-OCI8-on-RunCloud-Ubuntu-20.04.md
    Original file line number Diff line number Diff line change
    @@ -131,5 +131,4 @@ Test it on your web browser.
    ## References

    - [https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e](https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e)

    - [https://www.php.net/manual/en/oci8.installation.php](https://www.php.net/manual/en/oci8.installation.php)
  3. syahzul revised this gist Dec 1, 2020. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions How-To-Install-OCI8-on-RunCloud-Ubuntu-20.04.md
    Original file line number Diff line number Diff line change
    @@ -127,3 +127,9 @@ else {
    ```

    Test it on your web browser.

    ## References

    - [https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e](https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e)

    - [https://www.php.net/manual/en/oci8.installation.php](https://www.php.net/manual/en/oci8.installation.php)
  4. syahzul revised this gist Dec 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion How-To-Install-OCI8-on-RunCloud-Ubuntu-20.04.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ This tutorial only tested with Ubuntu Server 20.04 configured by [RunCloud](http
    Visit [Oracle Instant Client website](https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html) and download the following files:

    - instantclient-basic-linux.x64-19.9.0.0.0dbru.zip
    - instantclient-sdk-linux.x64-19.9.0.0.0dbru.zip.
    - instantclient-sdk-linux.x64-19.9.0.0.0dbru.zip

    ## Step 2

  5. syahzul revised this gist Dec 1, 2020. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions How-To-Install-OCI8-on-RunCloud-Ubuntu-20.04.md
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,7 @@ This tutorial only tested with Ubuntu Server 20.04 configured by [RunCloud](http

    ## Step 1

    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)

    Files:
    Visit [Oracle Instant Client website](https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html) and download the following files:

    - instantclient-basic-linux.x64-19.9.0.0.0dbru.zip
    - instantclient-sdk-linux.x64-19.9.0.0.0dbru.zip.
  6. syahzul revised this gist Dec 1, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions How-To-Install-OCI8-on-RunCloud-Ubuntu-20.04.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    # How To Install OCI8 on RunCloud Ubuntu 20.04

    This tutorial only tested with Ubuntu Server 20.04 configured by [RunCloud](https://runcloud.io/r/Prkd5Ly7e6wV).

    ## Step 1

  7. syahzul revised this gist Dec 1, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions How-To-Install-OCI8-on-RunCloud-Ubuntu-20.04.md
    Original file line number Diff line number Diff line change
    @@ -66,15 +66,15 @@ cd oci8-2.2.0

    ## Step 5

    We need autoconf installed before we can proceed.
    We need ```autoconf``` installed before we can proceed.

    ```
    apt install autoconf
    ```

    ## Step 6

    Install using PHPIZE
    Install using ```phpize``` provided by RunCloud.

    ```
    make clean
  8. syahzul revised this gist Dec 1, 2020. 1 changed file with 7 additions and 11 deletions.
    18 changes: 7 additions & 11 deletions How-To-Install-OCI8-on-RunCloud-Ubuntu-20.04.md
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,7 @@ ln -s /opt/oracle/instantclient_19_9/libclntsh.so.19.1 /opt/oracle/instantclient
    ln -s /opt/oracle/instantclient_19_9/libocci.so.19.1 /opt/oracle/instantclient_19_9/libocci.so
    ```

    ## Step 4
    ## Step 3

    Add the folder to our ```ldconfig```.

    @@ -45,38 +45,34 @@ sudo -s
    echo /opt/oracle/instantclient_19_9 > /etc/ld.so.conf.d/oracle-instantclient.conf
    ```


    Run the command below to update the Dynamic Linker Run-Time Bindings

    ```
    ldconfig
    ```

    ## Step 5
    ## Step 4

    Download oci8-2.2.0.tgz from official PHP website. Make sure not to download oci8-3.0.0.tgz since it's for PHP8.

    [https://pecl.php.net/get/oci8-2.2.0.tgz](https://pecl.php.net/get/oci8-2.2.0.tgz)

    ## Step 6

    Extract the file.
    Extract the downloaded file.

    ```
    tar -zxf oci8-2.2.0.tgz
    cd oci8-2.2.0
    ```

    ## Step 7
    ## Step 5

    We need autoconf installed before we can proceed.

    ```
    apt install autoconf
    ```


    ## Step 8
    ## Step 6

    Install using PHPIZE

    @@ -92,7 +88,7 @@ make clean
    make install
    ```

    ## Step 9
    ## Step 7

    Next, we need to create ini files for PHP.

    @@ -110,7 +106,7 @@ systemctl restart php73rc-fpm.service
    systemctl restart php72rc-fpm.service
    ```

    ## Test OCI8
    ## Test

    From your Terminal, check if the module is loaded:

  9. syahzul renamed this gist Dec 1, 2020. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Install PHP OCI8 on RunCloud Ubuntu 20.04
    # How To Install OCI8 on RunCloud Ubuntu 20.04


    ## Step 1
  10. syahzul created this gist Dec 1, 2020.
    136 changes: 136 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,136 @@
    # Install PHP OCI8 on RunCloud Ubuntu 20.04


    ## Step 1

    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)

    Files:

    - instantclient-basic-linux.x64-19.9.0.0.0dbru.zip
    - instantclient-sdk-linux.x64-19.9.0.0.0dbru.zip.

    ## Step 2

    Create a new folder to store Oracle Instant Client zip files on your server.

    ```
    sudo mkdir /opt/oracle
    ```

    Upload the downloaded files to this folder. Now we need to extract the files.

    ```
    cd /opt/oracle

    unzip instantclient-basic-linux.x64-19.9.0.1.0.zip
    unzip instantclient-sdk-linux.x64-19.9.0.1.0.zip
    ```

    Next, we need to create a symlink to Instant Client files.

    ```
    ln -s /opt/oracle/instantclient_19_9/libclntsh.so.19.1 /opt/oracle/instantclient_19_9/libclntsh.so
    ln -s /opt/oracle/instantclient_19_9/libocci.so.19.1 /opt/oracle/instantclient_19_9/libocci.so
    ```

    ## Step 4

    Add the folder to our ```ldconfig```.

    ```
    sudo -s
    echo /opt/oracle/instantclient_19_9 > /etc/ld.so.conf.d/oracle-instantclient.conf
    ```


    Run the command below to update the Dynamic Linker Run-Time Bindings

    ```
    ldconfig
    ```

    ## Step 5

    Download oci8-2.2.0.tgz from official PHP website. Make sure not to download oci8-3.0.0.tgz since it's for PHP8.

    [https://pecl.php.net/get/oci8-2.2.0.tgz](https://pecl.php.net/get/oci8-2.2.0.tgz)

    ## Step 6

    Extract the file.

    ```
    tar -zxf oci8-2.2.0.tgz
    cd oci8-2.2.0
    ```

    ## Step 7

    We need autoconf installed before we can proceed.

    ```
    apt install autoconf
    ```


    ## Step 8

    Install using PHPIZE

    ```
    make clean

    /RunCloud/Packages/php74rc/bin/phpize --clean

    /RunCloud/Packages/php74rc/bin/phpize

    ./configure --with-oci8=shared,instantclient,/opt/oracle/instantclient_19_9 --with-php-config=/RunCloud/Packages/php74rc/bin/php-config

    make install
    ```

    ## Step 9

    Next, we need to create ini files for PHP.

    ```
    echo "extension = oci8.so" >> /etc/php72rc/conf.d/oci8.ini
    echo "extension = oci8.so" >> /etc/php73rc/conf.d/oci8.ini
    echo "extension = oci8.so" >> /etc/php74rc/conf.d/oci8.ini
    ```

    Don't forget to restart PHP-FPM.

    ```
    systemctl restart php74rc-fpm.service
    systemctl restart php73rc-fpm.service
    systemctl restart php72rc-fpm.service
    ```

    ## Test OCI8

    From your Terminal, check if the module is loaded:

    ```
    php -i | grep 'oci8'
    ```

    If returns ```oci8```, its works!

    Or, create a PHP file and add the code below:

    ```
    <?php

    if (function_exists('oci_connect')) {
    echo 'OCI8 is working!';
    }
    else {
    echo 'Whoopss...not working!';
    }
    ```

    Test it on your web browser.