I have a simple php script:
<?php
$DB = '//10.11.201.170:1521/XE';
$DB_USER = 'BIOTPL';
$DB_PASS = 'biotpl';
$DB_CHAR = 'AL32UTF8';
$conn = oci_connect($DB_USER, $DB_PASS, $DB, $DB_CHAR);
if($conn)
{
echo "Successfully connected to Oracle.
";
OCILogoff($c);
//$statement = oci_parse($conn, 'select 1 from dual');
//oci_execute($statement);
//$row = oci_fetch_array($statement, OCI_ASSOC+OCI_RETURN_NULLS);
}
else
{
$err = OCIError();
echo "Connection failed." . $err[text];
}
?>
When I run it (from a browser or from the command line), I get the error::
Call to undefined function oci_connect
I'm using php 5.6.24 . I have copied php_oci8.dll and php_oci8_11g.dll to /ext folder . I have
extension=php_oci8.dll
extension=php_oci8_11g.dll
in my php.ini
I have installed instant client_11_2 - tried 32 bit version . I have ORACLE_HOME and TNS_ADMIN environment variables pointing at the instant client folder ( C:instantclient_11_2 ).
I have spent several hours over several days trying different things to no avail.
I have Installed Microsoft Visual C++ 2010 Runtime (x86). This is needed for the OCI8 extension. I have Installed Microsoft Visual C++ 2012 Runtime (x86). This is needed for PHP.
When I have tried the following command :
php --ri oci8
I have the following error :
PHP Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_oci8.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_oci8.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_oci8_11g.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_oci8_11g.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
Extension 'oci8' not present.
How can I remove the following error ?
Fatal error: Call to undefined function oci_connect()
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…