XAMPP 7 PHP7 Oracle 11g Express Edition Windows7設定

1. Download
– Oracle 11g ( registration required to download )
http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html
– Oracle Instant Client ( registration required to download )
http://www.oracle.com/technetwork/topics/winsoft-085727.html
– XAMPP 7.0.13 with PHP7
https://www.apachefriends.org/download.html

 2. Install Oracle 11g
– note password for SYSTEM \ SYS user
e.g. samuraikit123     🙂

 3. Setup  Oracle Instant sClient
– unzip to C:\
– update Windows Environment variable Path
add C:\instantclient_12_1;

 4. Install XAMPP 7.0.13 with PHP7
– edit php.ini – enable OCI extension – php_oci8_12c.dll
( remove semicolon – ; ) + save
– start Apache

5. Connection test PHP script
– create file testoracle.php
in C:\xampp\htdocs\ folder
– type following text

<?php 

//Oracle DB user name
$username = ‘SYSTEM’;

// Oracle DB user password
$password = ‘samuraikit123’;

// Oracle DB connection string
$connection_string = ‘localhost/xe’;

//Connect to an Oracle database
$connection = oci_connect(
 $username,
 $password,
 $connection_string
);

If (!$connection)
   echo ‘Oops 🙁 connection failed’;
else
   echo ‘Hooray !!! 🙂 Oracle DB + php => OK ‘;

// Close connection 
oci_close($connection);

?>