Ubuntu, PHP, and Oracle Instant Client
Published 2010-9-12A year or so ago I was using php (yuck!) and Oracle (yuck!) and I made a post about getting to work with ubuntu:
Installing Oracle Instant Client 11.1, php_pdo, & oci8
This is the script I found in my ~/
that prompted me to document this for future reference. This may be better or worse or the same as the one on the forum.
<?php
# USAGE: ORACLE_HOME=/opt/oracle/instantclient/ TNS_ADMIN=/opt/oracle/intstantclient/network/admin/ php $this_file
# http://wiki.oracle.com/page/PHP+Oracle+FAQ
# http://download-west.oracle.com/docs/cd/B12037_01/network.101/b10775/naming.htm#i498306
echo 'Connecting using EZCONNECT dsn';
$username = 'myusername';
$password = 'mypassword';
$host = 'db.example.org';
$port = '1521';
$tns_service_name = 'SOMENAME';
$service_name = 'dbinstance.example.org';
echo "\nConnecting using EZCONNECT dsn\n";
oci_connect($username, $password, "//$host:$port/$service_name");
echo "Connecting using TNSNAMES service name\n";
oci_connect($username, $password, $tns_service_name);
echo "\n";
?>
By AJ ONeal
Thanks!
It's really motivating to know that people like you are benefiting
from what I'm doing and want more of it. :)
Did I make your day?
Buy me a coffee
(you can learn about the bigger picture I'm working towards on my patreon page )