致命错误:调用未定义的函数 oci_connect()

我没有注释下一行(在我的 php.ini 中):

I have the next lines uncommented (in my php.ini):

extension=php_oracle.dll 
extension=php_oci8.dll

然后我下载了这个文件 instantclient-basiclite-nt-11.2.0.2.0.zip 并解压缩并将其放在驱动器 D...

And I downloaded this file instantclient-basiclite-nt-11.2.0.2.0.zip and unzipped and put that on drive D...

我使用的是 Windows XP

I am using Windows XP

我这样设置环境变量:

LD_LIBRARY_PATH     C:instantclient_11_2:$LD_LIBRARY_PATH 
ORACLE_HOME     C:instantclient_11_2 

但是当我执行 oci_connect() 函数时,我看到了这个错误:

But when I execute oci_connect() function, I see this error :

致命错误:调用未定义的函数 oci_connect() in ...

Fatal error: Call to undefined function oci_connect() in ...

我在 erroeLog 文件中发现了这个警告:

and i found this warnings on erroeLog file:

[2011 年 12 月 29 日 00:36:39] PHP 警告:PHP 启动:无法加载动态库 'c:phpextphp_oci8.dll' - 找不到指定的模块.在未知的第 0 行

[29-Dec-2011 00:36:39] PHP Warning: PHP Startup: Unable to load dynamic library 'c:phpextphp_oci8.dll' - The specified module could not be found. in Unknown on line 0

[29-Dec-2011 00:36:39] PHP 警告:PHP 启动:无法加载动态库 'c:phpextphp_oracle.dll' - 找不到指定的模块.

[29-Dec-2011 00:36:39] PHP Warning: PHP Startup: Unable to load dynamic library 'c:phpextphp_oracle.dll' - The specified module could not be found.

推荐答案

检查事项:

  • 您不需要设置 LD_LIBRARY_PATHORACLE_HOME.但是,您需要将 D:instantclient_11_2 添加到 PATH 环境变量并重新启动计算机以使更改生效.

  • You don't need to set LD_LIBRARY_PATH nor ORACLE_HOME. However, you need to add D:instantclient_11_2 to the PATH environmental variable and restart the computer so changes apply.

在配置 PHP 之前,请检查您的 Oracle 客户端库是否确实有效(例如,尝试连接 SQL Developer).

Before configuring PHP, check that your Oracle client libraries actually work (for instance, try to connect with SQL Developer).

注释掉 extension=php_oracle.dll.它属于旧的且已弃用的 Oracle 扩展.

Comment out the extension=php_oracle.dll. It belongs to the old and deprecated Oracle extension.

仔细检查php_oci8.dll 文件是否真的位于c:phpextphp_oci8.dll?

Double check that the php_oci8.dll file is really at c:phpextphp_oci8.dll?

相关文章