简体   繁体   English

无法加载oci8 - >致命错误:调用未定义的函数oci_connect()

[英]can not load oci8 -> Fatal error: Call to undefined function oci_connect()

I want to connect to my oracle database, but i have a problem with function oci_connect. 我想连接到我的oracle数据库,但我的函数oci_connect有问题。 i have tried to uncomment this: 我试图取消注释:

extension=php_oci8.dll 

but, still have an error : 但是,仍然有一个错误:

Fatal error: Call to undefined function oci_connect() in C:\\xampp\\htdocs\\testing\\db.php on line 71 致命错误:在第71行的C:\\ xampp \\ htdocs \\ testing \\ db.php中调用未定义的函数oci_connect()

But, when i check in phpinfo(), oci8 still not loaded and i can not connect to my oracle database. 但是,当我检查phpinfo()时,oci8仍然没有加载,我无法连接到我的oracle数据库。 i already restart my apache. 我已经重启了我的apache。 How i fix this problem ? 我如何解决这个问题? Canyou help me? 你能帮助我吗?

Thank you.. 谢谢..

In php.ini ensure that you enable the correct OCI extension (11g), like this: php.ini确保启用正确的OCI扩展(11g),如下所示:

;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client

As long as you've got Oracle 11gR2 or greater client libraries correctly installed you should now be able to run: 只要您正确安装了Oracle 11gR2或更高版本的客户端库 ,您现在就可以运行:

C:\>php --ri oci8

And get the result: 得到结果:

oci8

OCI8 Support => enabled
Version => 1.4.10
Revision => $Id: b0984d94e17f7c099470cd0a9404259f2a59da04 $
Active Persistent Connections => 0
Active Connections => 0
Oracle Run-time Client Library Version => 11.2.0.3.0
Oracle Instant Client Version => 11.2
Temporary Lob support => enabled
Collections support => enabled

Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value
oci8.events => Off => Off

To check your Oracle client is installed correctly (ie, in your environment PATH variable) you can run: 要检查Oracle客户端是否已正确安装(即,在您的环境PATH变量中),您可以运行:

C:\>where oci*

You should get a result like this: 你应该得到这样的结果:

C:\instantclient_11_2\oci.dll
C:\instantclient_11_2\oci.sym
C:\instantclient_11_2\ocijdbc11.dll
C:\instantclient_11_2\ocijdbc11.sym
C:\instantclient_11_2\ociw32.dll
C:\instantclient_11_2\ociw32.sym

In Ubuntu 16.04, using PHP 5.6, with 64bit os, try this: 在Ubuntu 16.04中,使用PHP 5.6,64位操作系统,试试这个:

Install the packages: 安装包:

sudo apt-get install php5.6-dev build-essential php-pear libaio1

Download the latest version of the packages from: 从以下位置下载最新版本的软件包:

http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

Search for these packages, according with the latest version: 根据最新版本搜索这些包:

oracle-instantclientXX.X-basic-XX.X.X.X.X-X.x86_64.rpm
oracle-instantclientXX.X-devel-XX.X.X.X.X-X.x86_64.rpm

Converting packages: 转换包:

sudo apt-get install alien
sudo alien oracle-instantclientXX.X-basic-XX.X.X.X.X-X.x86_64.rpm
sudo alien oracle-instantclientXX.X-devel-XX.X.X.X.X-X.x86_64.rpm

Installing: 安装:

sudo dpkg -i oracle-instantclientXX.X-basic_XX.X.X.X.X-X_amd64.deb
sudo dpkg -i oracle-instantclientXX.X-devel_XX.X.X.X.X-X_amd64.deb

Installing oci8: 安装oci8:

sudo pecl install oci8-2.0.12

*Build process completed successfully
Installing '/usr/lib/php/20131226/oci8.so'
install ok: channel://pecl.php.net/oci8-2.0.12
configuration option "php_ini" is not set to php.ini location
You should add "extension=oci8.so" to php.ini*

Add the extension to php: 将扩展名添加到php:

sudo gedit /etc/php/5.6/apache2/php.ini

add the extension: 添加扩展名:

extension=oci8.so

Restart apache: 重启apache:

sudo service apache2 restart

That's it. 而已。

Follow the offcial link for me Oracle 请关注Oracle的官方链接

http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html

Here is what worked with Xammp 这是Xammp的功能

1.uncomment extension=php_oci8_11g.dll ; 1.uncomment extension = php_oci8_11g.dll; Use with Oracle 11gR2 Instant Client if you are using 11g (in php.ini) 如果您使用的是11g(在php.ini中),请与Oracle 11gR2 Instant Client一起使用

2.add AddHandler fcgid-script .php to httpd.conf 2.添加AddHandler fcgid-script .php到httpd.conf

3.Download the FastCGI component mod_fcgid-2.3.6-win32-x86.zip from httpd.apache.org/download.cgi#mod_fcgid 3.Download从FastCGI的部件mod_fcgid-2.3.6-win32-x86.zip httpd.apache.org/download.cgi#mod_fcgid

4.Unzip it to the installed Apache 2.2 directory. 4.将其解压缩到已安装的Apache 2.2目录。 The C:\\xamp\\apache\\modules directory should now have mod_fcgid.so and mod_fcgid.pdb files. C:\\ xamp \\ apache \\ modules目录现在应该有mod_fcgid.so和mod_fcgid.pdb文件。

5.Download the "Instant Client Package - Basic" for Windows from the OTN Instant Client page. 5.从OTN Instant Client页面下载适用于Windows的“Instant Client Package - Basic”。 Because PHP is 32 bit, use the 32 bit version of Instant Client. 因为PHP是32位,所以使用32位版本的Instant Client。

Unzip the Instant Client files to C:\\instantclient_11_2 将Instant Client文件解压缩到C:\\ instantclient_11_2

Edit the Windows PATH environment setting and add C:\\instantclient_11_2. 编辑Windows PATH环境设置并添加C:\\ instantclient_11_2。 For example, on Windows XP, follow Start -> Control Panel -> System -> Advanced -> Environment Variables and edit PATH in the System variables list. 例如,在Windows XP上,按照开始 - >控制面板 - >系统 - >高级 - >环境变量,在系统变量列表中编辑PATH。

Commonly you need to reboot Windows so the new environment is correctly set. 通常,您需要重新启动Windows,以便正确设置新环境。

that worked for me all the best 这对我来说一切顺利

Have a look at RO_engineer 's answer of installing x86 files of Oracle insta client rather than x64 version. 看看RO_engineer关于安装Oracle insta客户端的x86文件而不是x64版本的答案。 It resolved my issue, may be that can help you too. 它解决了我的问题,可能对你也有帮助。

https://stackoverflow.com/a/27177616/289587 https://stackoverflow.com/a/27177616/289587

Download Instant Client for Microsoft Windows (32-bit) 下载适用于Microsoft Windows的Instant Client(32位)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP8 + Oracle OCI8 => 致命错误:未捕获错误:调用未定义的函数 oci_connect() - PHP8 + Oracle OCI8 => Fatal error: Uncaught Error: Call to undefined function oci_connect() 致命错误:调用未定义的函数 oci_connect() php 错误 - Fatal error: Call to undefined function oci_connect() php error 致命错误:调用Wamp中未定义的函数oci_connect() - Fatal error: Call to undefined function oci_connect() in Wamp 致命错误:调用未定义函数oci_connect() - Fatal error: Call to undefined function oci_connect() 调用未定义函数 oci_connect() - Call to undefined function oci_connect() PHP中的Oracle连接错误。 致命错误:调用未定义函数oci_connect() - Oracle Connection Error in PHP. Fatal error: Call to undefined function oci_connect() WAMP服务器由于致命错误而停止工作:调用未定义函数oci_connect() - WAMP server stopped working due to Fatal error: Call to undefined function oci_connect() 致命错误:在第3行的C:\\ xampp \\ htdocs \\ Project1 \\ connect.php中调用未定义函数oci_connect() - Fatal error: Call to undefined function oci_connect() in C:\xampp\htdocs\Project1\connect.php on line 3 致命错误:未捕获错误:通过命令提示符运行php脚本时调用未定义函数oci_connect() - Fatal error: Uncaught Error: Call to undefined function oci_connect() while running the php script through command prompt 致命错误:在第71行的C:\\ xampp81 \\ htdocs \\ aaainc \\ db.php中调用未定义函数oci_connect() - Fatal error: Call to undefined function oci_connect() in C:\xampp81\htdocs\aaainc\db.php on line 71
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM