简体   繁体   English

使用PHP从Oracle获取数据

[英]Get data from oracle with php

I'm trying to develop website using php but I have two servers: 我正在尝试使用php开发网站,但我有两个服务器:

*one for php files *一个用于php文件

*other one for database (oracle) *另外一个用于数据库(oracle)

so I'm trying to get data from database using following connection string 所以我正在尝试使用以下连接字符串从数据库中获取数据

$dbstr=
  (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=xxx.xx.x.xx)
      (PORT=1521)
    )
    (CONNECT_DATA=
      (SERVER=dedicated)
      (SERVICE_NAME=BHDB)
    )
  )
    global $objConnect;
    $objConnect = oci_connect('building', 'building', $dbstr, 'AL32UTF8');
if (!$objConnect) {
            $e = oci_error();
            trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
        }

but in oci_connect the file can't display any thing in php (blank page) 但在oci_connect中,文件无法在php中显示任何内容(空白页)

but I don't know the problem 但我不知道问题

Add

error_reporting(E_ALL);  // In PHP 5.3 use E_ALL|E_STRICT
ini_set('display_errors', 'On');

to your script and check the errors. 到脚本并检查错误。

You can simplify your connection string to: 您可以将连接字符串简化为:

$dbstr='xxx.xx.x.xx/BHDB';

I get the impression you haven't read the Underground PHP & Oracle Manual . 我的印象是您还没有阅读Underground PHP&Oracle Manual

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

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