简体   繁体   English

从 PHP OCI8 以 SYS 身份连接到 Oracle 数据库

[英]Connecting as SYS to an Oracle Database from PHP OCI8

I'm trying to access the ORACLE database from PHP, i'm using WampServer Version 2.2 Apache 2.4.2 – PHP 5.4.3 and oracle 11g.我正在尝试从 PHP 访问 ORACLE 数据库,我使用的是 WampServer 2.2 版 Apache 2.4.2 – PHP 5.4.3 和 oracle 11g。 I tried many ways including :我尝试了很多方法,包括:

<?php

if ($conn = oci_connect('sys as sysdba', '12345', '//localhost/orcl'))
{
    print 'Successfully connected to Oracle Database!';     
}
else
{
     $errmsg = oci_error();
     print 'Oracle connection failed' . $errmsg['message'];
}
?>

i get the following error every time i execute:每次执行时都会出现以下错误:

Fatal error: Call to undefined function OCILogon() in C:\wamp\www\IDS\Index.php on line 3

Does anyone know how to solve this ??有谁知道如何解决这个问题??

I had to remove the ";"我不得不删除";" semicolon from the php.ini file at the oci8 line来自php.ini文件中 oci8 行的分号

it was like this:它是这样的:

;extension=php_oci8.dll

i changed it to:我把它改成:

extension=php_oci8.dll

The correct connect string would look like正确的连接字符串看起来像
$conn = oci_connect('sys', '12345', '//localhost/orcl', null, OCI_SYSDBA))

Make sure you have确保你有
oci8.privileged_connect = on in your php.ini in order to enable privileged connections. oci8.privileged_connect = on在您的php.ini中以启用特权连接。 Look out for this parameter in the [OCI8] section of your php.ini.在 php.ini 的 [OCI8] 部分注意这个参数。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM