Fatal error: Call to undefined function oci_connect()

心已入冬 提交于 2019-11-26 07:49:11

问题


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

extension=php_oracle.dll 
extension=php_oci8.dll

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

I am using 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 :

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

and i found this warnings on erroeLog file:

[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.


回答1:


Things to check:

  • 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.

  • 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.dll file is really at c:\php\ext\php_oci8.dll?




回答2:


Did you restart apache after putting the php_oci8.dll file in your php/ext directory?




回答3:


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.

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

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



来源:https://stackoverflow.com/questions/8635881/fatal-error-call-to-undefined-function-oci-connect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!