调用未定义的函数 oci_connect、php_oci8_11g.dll、windows 10、php5.6.24 [英] Call to undefined function oci_connect, php_oci8_11g.dll , windows 10, php5.6.24

查看:25
本文介绍了调用未定义的函数 oci_connect、php_oci8_11g.dll、windows 10、php5.6.24的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的 php 脚本:

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

我使用的是 php 5.6.24 .我已将 php_oci8.dll 和 php_oci8_11g.dll 复制到/ext 文件夹.我有

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  

在我的 php.ini 中我已经安装了 Instant client_11_2 - 尝试了 32 位版本.我有 ORACLE_HOME 和 TNS_ADMIN 环境变量指向即时客户端文件夹 ( C:instantclient_11_2 ).

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.

我已安装 Microsoft Visual C++ 2010 运行时 (x86).这是 OCI8 扩展所需要的.我已经安装了 Microsoft Visual C++ 2012 运行时 (x86).这是 PHP 所必需的.

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.

当我尝试以下命令时:

php --ri oci8

我有以下错误:

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.

如何消除以下错误?

Fatal error: Call to undefined function oci_connect() 

推荐答案

您收到 OCI8 扩展的启动错误,表明您的 php 版本使用了不受支持的 dll.您需要使用正确的一个,对于 PHP 5.6.x,它是其中之一:

You are getting startup errors for the OCI8 extension indicating that you are using an unsupported dll for your php version. You need to use the correct one, which - for PHP 5.6.x - is one of these:

您需要选择与您的架构(x86 或 x64)、编译器(vc 9、11、14)和线程安全 (ts) 或非线程安全 (nts) php 版本相匹配的版本,例如如果您在 x86 上运行使用 vc11 编译的线程安全 PHP 5.6.24,则可以使用

You need to take the one that matches your architecture (x86 or x64), compiler (vc 9, 11, 14) and thread-safe (ts) or non-thread-safe (nts) php version, e.g. if you are running a thread-safe PHP 5.6.24 compiled with vc11 on an x86, you'd use

php_oci8-2.0.8-5.6-ts-vc11-x86.zip
-------- ----- --- -- ---- --- ---
^        ^     ^   ^  ^    ^   ^
|        |     |   |  |    |   \_____ extension
|        |     |   |  |    \_________ architecture
|        |     |   |  \______________ compiler
|        |     |   \_________________ thread-safety mode
|        |     \_____________________ php version
|        \___________________________ extension version
\____________________________________ extension name

如果没有与您的PHP匹配的下载,则它不存在,您需要自己编译.更多信息请访问 http://windows.php.net

If there is no download matching your PHP, then it does not exist and you need to compile it yourself. More info at http://windows.php.net

附带说明:除上述之外,您一次只能使用一个 oci 扩展名.你得到了(php_oci8.dll 和 php_oci8_11g.dll).确保删除您不需要的那个.

On a side note: in addition to the above, you can only use one oci extension at a time. You got both (php_oci8.dll and php_oci8_11g.dll). Make sure to remove the one you don't need.

这篇关于调用未定义的函数 oci_connect、php_oci8_11g.dll、windows 10、php5.6.24的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆