1
votes

I installed the oracle instant client 12, but I can't connect the php with OCI8. I am using XAMPP 32bit and PHP 7.0.15. In my phpinfo() don't show the OCI section. Please, I'm stuck in this problem for a few days. :/ Thanks for all!

2

2 Answers

2
votes

Well, the problem was that XAMPP as well PECL(web site) has the wrong (or outdate) DLL for OCI8. So this link here has the correctly DLLs for PHP.

0
votes

You must check if your php is using x86 architecture, since you are using XAMPP-32bits.

If you go to your xampp/php directory through cmd, in my case it was "C:\xampp\php", and start the php by the simple command "php" it will probably show what dlls are not being found in the etc folder or which of those are not Win 32 compatible.

If that's the case, with win 32 compatibility problems or not finding the dlls that you are certain are there, you should check if there is in the path variables any source that miss locate your php in use, the point here is to use the one given by default in XAMPP. If you need an updated OCI8 dll you can download it on https://pecl.php.net/package/oci8 , but remember to check the Thread Safety compatibility, you can find it on your phpinfo page as well. In my case it was enough to use the one provided by XAMPP.

After this, you have to enable the extension:

 extension=oci8_12c

in the php.ini configuration file. It was enough for me to enable only this one, although some people suggests to also enable extension=pdo_oci. My suggestion is to try this only if you failed to install with the path here shown. It's also good to check if you are set in the correct path regarding the extensions, in my case:

extension_dir="C:\xampp\php\ext"

After this, you have to download the Oracle Instant Client. Since you are using x86 architecture, you need to find a 32-bit version of the OCI, but is also important to check which one is compatible with the extension you uncommented. In my case, of oci8_12c, it was instantclient-basic-nt-12.2. The final step is to unzip it to a folder, like "C:\instantclient_12_2" and add it to the path variables of the system. Reload apache and check if the OCI8 is shown correctly.

If you solved the problem, you will be able to see the OCI8 page when opening a phpinfo() page:

enter image description here