Three things needed for connecting with oracle database with PHP.
- Instant Client
Those three option should be the same version, same configuration with with each one. Suppose, if our machine has 64bit , then PHP, OCI and instant client should be the same 64Bit system.
Step 1: Download PHP 7.2
Here, things to notice is:
- PHP version 7.2
- TS version
- VC 15
I explain what those words mean. First, TS mean it is thread safe. That mean, this program can multitask or multi threading enabled. Second, VC 15 means, VC15 (Visual Studio 2015 compiler) and include improvements in performance and stability. And we all know that x64 architecture.
Step 2: Download Oracle Instant Client
We need to download three packages from here.
- Basic Package
Though we’ve downloaded the PHP version x64 that’s why we are downloading the x64 version of Instant Client.
Make a directory in C drive and uncompress all the files to this directory.
Add a new Path to System Variable in our computer. And put the directory where is your Instant Client files in the path value.
Create a new system variable: TNS_ADMIN
Point the directory in that value too.
RESTART YOUR COMPUTER
Step 3: Download the actual OCI8 package
You can download the latest version if you want . As we are using PHP version 7.2 select that version and Thread Safe respectably.
Extract that into: YOURXAMPPDIRECTORY/php/ext directory. Enable it by uncommeting
Done! Check your phpinfo , a new OCI8 options are available in here.