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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8635881/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 05:08:34  来源:igfitidea点击:

Fatal error: Call to undefined function oci_connect()

phporacleiisociinstantclient

提问by afsane

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

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

extension=php_oracle.dll 
extension=php_oci8.dll

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

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

I am using Windows XP

我使用的是 Windows XP

I set environment variable like this:

我这样设置环境变量:

LD_LIBRARY_PATH     C:\instantclient_11_2:$LD_LIBRARY_PATH 
ORACLE_HOME     C:\instantclient_11_2 

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

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

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

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

and i found this warnings on erroeLog file:

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

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

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

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

[2011 年 12 月 29 日 00:36:39] PHP 警告:PHP 启动:无法加载动态库 'c:\php\ext\php_oracle.dll' - 找不到指定的模块。

回答by álvaro González

Things to check:

检查事项:

  • You don't need to set LD_LIBRARY_PATHnor ORACLE_HOME. However, you need to add D:\instantclient_11_2to the PATHenvironmental variable and restart the computer so changes apply.

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

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

  • Double check that the php_oci8.dllfile is really at c:\php\ext\php_oci8.dll?

  • 您不需要设置LD_LIBRARY_PATHORACLE_HOME. 但是,您需要添加D:\instantclient_11_2PATH环境变量并重新启动计算机才能应用更改。

  • 在配置 PHP 之前,请检查您的 Oracle 客户端库是否实际工作(例如,尝试连接 SQL Developer)。

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

  • 仔细检查php_oci8.dll文件是否真的在c:\php\ext\php_oci8.dll?

回答by Tom van der Woerdt

Did you restart apache after putting the php_oci8.dllfile in your php/extdirectory?

php_oci8.dll文件放入php/ext目录后是否重新启动了apache ?

回答by user3269964

Just add this line to the php.in file that point to the location of extensions, should know where they are located, but normally in php folder.

只需将此行添加到指向扩展位置的 php.in 文件中,应该知道它们位于何处,但通常在 php 文件夹中。

extension_dir = C:\xampp\php\ext ;this is for me using xampp, be wise.

extension_dir = C:\xampp\php\ext ;这是给我使用 xampp 的,要明智。

It worked for me. The problem is with accessing the extensions and has nothing to do with oracle libraries.

它对我有用。问题在于访问扩展,与 oracle 库无关。