0
votes

I'm trying to enable extenion oci8

I uncommented its line in php.ini and added the required files for it ( oracle instant client).

Now from CMD, when I type: php --ri oci8, it shows :

oci8

OCI8 Support => enabled OCI8 DTrace Support => disabled OCI8 Version => 2.1.8 Revision => $Id: 4543974aab26d8a3d85257ab18d0dca4503ff9e7 $ Oracle Run-time Client Library Version => 12.1.0.2.0 Oracle Compile-time Instant Client Version => 12.1

Directive => Local Value => Master Value oci8.max_persistent => -1 => -1 oci8.persistent_timeout => -1 => -1 oci8.ping_interval => 60 => 60 oci8.privileged_connect => Off => Off oci8.statement_cache_size => 20 => 20 oci8.default_prefetch => 100 => 100 oci8.old_oci_close_semantics => Off => Off oci8.connection_class => no value => no value oci8.events => Off => Off

Statistics => Active Persistent Connections => 0 Active Connections => 0

So it should working fine. But when I try to connect to oracle from php I get error :

Call to undefined function Yajra\Pdo\oci_connect()

I opened to PHPINFO page, searched for oci8, the block that must be present to show it's enabled is not present.

What may be the problem? I'm using xampp 7.2 on windows 10

2
Quick note - there are sometimes different php.ini files for cli and web. Since you're using XAMPP, I'd imagine that this is more likely again. I'm not familiar with XAMPP, but check if there's a config editor that allows you inspect the php.ini for that environment.Darragh Enright
Use echo phpinfo() from web, and look at this params "Configuration File (php.ini) Path", "Loaded Configuration File", "Scan this dir for additional .ini files", "Additional .ini files parsed", them can help you to know where .ini files are locatedFrancesco Simeoli

2 Answers

1
votes

Solved.

It was that my PC required restart not just Apache for PHP web to load the new enviroment variables, which is important in locating oracle instant client, which is needed by the PHP extension OCI8.

The strange thing is that PHP CLI loaded the new enviroment variables, but the PHP web didn't load it although Apache is restarted. I noticed that from PHPinfo page, which displays the loaded envirmonment variables showing the old ones before adding oracle.

So just restated my PC and everything is now OK. Thanks for your advice.

0
votes

You must edit the php.ini file which is shown in phpinfo ("Loaded Configuration File ") option and apache restart is also required for it to work.