doujiepin5547 2018-10-16 04:51
浏览 31

PHP Oracle连接

I am attempting to write some connection code with PHP to a Oracle database my school is hosting.

I'm using oci_connect() at the moment to make this connection, but it is failing.

$conn = oci_connect('username', 'password', 'hostname/SID');

I can access the oracle database through sqlDeveloper, as well as phpmyadmin, so I know the login information is correct.

I checked the oracle version with select * from v$version;, it shows as 12c Enterprise.

What is wrong with my php code for connecting? Is there a better way to make an oracle connection through PHP?

This is the test code I'm running, from http://php.net/manual/en/function.oci-error.php

 <?php
echo "running";
$conn = oci_connect("username", "paswwrod", "address/SID");
if (!$conn) {
    $e = oci_error();   // For oci_connect errors do not pass a handle
    trigger_error(htmlentities($e['message']), E_USER_ERROR);
}
echo "ending";


?> 

The string "running" gets echoed, but "ending" does not, the script just stops working when it attempts oci_connect()

  • 写回答

1条回答 默认 最新

  • doujuan2688 2018-10-16 06:12
    关注

    have you also tried including the port number to the oracle db server like so?

    $conn = oci_connect("user", "pass", "localhost:1234/xe");

    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)