Langsung ke konten utama

Install Oci8 ubuntu 16.04

First Prerequirements are a working apache2 and php7.2 (Ubuntu 18.04) environment.
  1. Download the basic (like instantclient-basic-linux.x64-12.2.0.1.0.zip) and the SDK (instantclient-sdk-linux.x64-12.2.0.1.0.zip) package from the Oracle Website http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html
  2. Upload both files to your web server, you can use WinSCP for it
  3. Unzip both files on a server, in my case, you will get a new folder named "instantclient_12_2"
4a. Create a destination folder

mkdir /opt/oracle
4b. Move and rename the instantclient folder

mv instantclient_12_2 /opt/oracle/instantclient
4c. Change rights on the folder
chown -R root:www-data /opt/oracle
  1. Check if you have the required packages for installing OCI8
apt install php7.2-dev php-pear build-essential libaio1
  1. Create necessary soft links
ln -s /opt/oracle/instantclient/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so
ln -s /opt/oracle/instantclient/libocci.so.12.1 /opt/oracle/instantclient/libocci.so
7a. Add instant client to ld config files
echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf
7b. Update Dynamic Linker Run-Time Bindings
ldconfig
8a. Now install OCI8 by pecl
pecl install oci8
8b. The OCI8 installation is asking you for the right folder
instantclient,/opt/oracle/instantclient
9a. Add oci lib to the cli php config (console php)
echo "extension = oci8.so" >> /etc/php/7.2/cli/php.ini
9b. Add oci lib to the apache php config
echo "extension = oci8.so" >> /etc/php/7.2/apache2/php.ini
10a. Set environment variables for the CLI version (you will need to reboot the server after)
echo "LD_LIBRARY_PATH=\"/opt/oracle/instantclient\"" >> /etc/environment
echo "ORACLE_HOME=\"/opt/oracle/instantclient\"" >> /etc/environment
10b. Set environment variables for the Apache version
echo "export LD_LIBRARY_PATH=\"/opt/oracle/instantclient\"" >> /etc/apache2/envvars
echo "export ORACLE_HOME=\"/opt/oracle/instantclient\"" >> /etc/apache2/envvars
  1. Restart Apache
service apache2 restart
  1. You're done, now you can test your connection to the Oracle database
=PHP CONNECTION EXAMPLE=
<?php
// Create connection to Oracle, change HOST IP and SID string!
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 000.000.000.000)(PORT = 1521)))(CONNECT_DATA=(SID=XXX)))";
// Enter here your username (DBUSER) and password!
$conn = oci_connect("DBUSER", "PASSWORD",$db);
if (!$conn) {
   $m = oci_error();
   echo $m['message']. PHP_EOL;
   exit;
}
else {
   print "Oracle database connection online". PHP_EOL;
}

?>

Komentar

Postingan populer dari blog ini

Mengatasi Error DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

Jika di mysql mendapatkan error seperti dibawah ini: 1418 (HY000) at line 10185: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) dapat diselesaikan dengan cara: 1. jalan kan di cmd/terminal: SET GLOBAL log_bin_trust_function_creators = 1; 2. Masukan di konfgurasi my.cnf : log_bin_trust_function_creators = 1;

Membuat BOT Telegram Dengan Mudah

BOT dapat kita sebut sebagai ROBOT, dapat diciptakan untuk membantu dan mempermudah pekerjaan atau tugas manusia. BOT lebih tepatnya diciptakan untuk melakukan tugas-tugas tertentu yang dirangkai sedemikian rupa berdasarkan kondisi untuk memecahkan permasalahan-permasalah khusus. Persiapan Dan Cara Kerja Bot Telegram 1. pilih bahasa pemrograman yang akan digunakan 2. berikutnya kita harus memiliki setidak-tidaknya 1 account telegram dan 1 account Bot 3. memahami adalah cara kerja bot telegram Mendaftarkan BOT untuk mendaftarkan akun BOT, kita gunakan layanan @BotFather dari telegram, carilah account telegram dengan nama @BotFather. ketik /start dan akan muncul beberapa keterangan command yang dapat digunakan. dari beberapa command tsb, kita gunakan commad /newbot untuk membuat bot baru, lalu isikan nama BOT yang akan digunakan, dan diakhiri dengan tulisan bot (misal SlemanBot) maka BOT yang saya buat sudah jadi, dan saya mendapatkan TOKEN API BOT Tsb. nah u...

Tutorial Install SQLmap Ubuntu

sqlmap merupakan tools/alat opensource yang mendeteksi dan melakukan exploit pada Bug SQLinjection. dengan melakukan serangan SQL injection, peretas dapat mengambil alih hingga dapat memanipulasi sebuah database di dalam sebuah server. Sebelumnya, apa itu SQL Injection? SQL injection merupakan teknik hacking di mana peretas dapat menyisipkan perintah-perintah SQL melalu URL untuk di eksekusi oleh database. bug atau vulnerability ini terjadi karena kelalian seorang programer atau webmaster dalam melakukan pemograman web seperti tidak difilternya variabel dalam web tersebut. Cara installnya? $ sudo apt-get install git $ git clone https://github.com/sqlmapproject/sqlmap.git Untuk Menjalankannya, $ cd /patch/to/sqlmap/ jalankan dengan perintah dasar $ python sqlmap.py -h << untuk melihat basic options $ python sqlmap.py -u 'http://alamat.com'  contoh lain: $ python sqlmap.py --url=”http://192.168.152.129/dvwa/vulnerabilities/sqli/? id=1&Submit=S...