Heim php教程 php手册 Windows2003 + PHP5.4.7 + Apache2.2.15 + Oracle9.0

Windows2003 + PHP5.4.7 + Apache2.2.15 + Oracle9.0

Jun 06, 2016 pm 07:57 PM

Oracle数据库与Web服务器分布在两台机器上。 Web端的配置: 下载 oracle instant client:instantclient_10_2,存放路径:D:\oracle_instantclient\instantclient_10_2 Windows 的系统 Path 变量前加:D:\oracle_instantclient\instantclient_10_2 路径。 ph

    Oracle数据库与Web服务器分布在两台机器上。

    Web端的配置:

    下载 oracle instant client:instantclient_10_2,存放路径:D:\oracle_instantclient\instantclient_10_2
    Windows 的系统 Path 变量前加:D:\oracle_instantclient\instantclient_10_2 路径。
    php.ini 中打开 oci 开关:
     extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
     extension=php_pdo_oci.dll
    重新启动 Apache 服务。这时,可以在 phpinfo 信息里看到 oci8 已经加载成功。?

    但是,运行PHP的测试代码,oci_connect()函数报错:
    oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in ...
    pdo_oci报错:
    SQLSTATE[42S02]: pdo_oci_handle_factory: ORA-12154: TNS:could not resolve the connect identifier specified (ext\pdo_oci\oci_driver.c:631)

    解决:
    建立系统环境变量:
    TNS_ADMIN = D:\oracle_instantclient\instantclient_10_2
    NLS_LANG = AMERICAN_AMERICA.UTF8
    重新启动 Apache 服务。
    同时,需要 tnsnames.ora 网络配置文件(位于D:\oracle_instantclient\instantclient_10_2下),用于PHP去解析SERVICE_NAME,例如:
    # TNSNAMES.ORA Network Configuration File
    tns1 =
      (DESCRIPTION=
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL=TCP)(HOST = 10.0.0.90)(PORT = 1521))
        )
        (CONNECT_DATA=
          (SERVICE_NAME=mydb90)
        )
      )
    更改 tnsnames.ora 文件,需要重新启动 Apache 服务,从而让 PHP 识别新的 tnsnames.ora 配置。
    PHP 的 oci 连接示例:$conn=oci_connect("scott", "tiger", "tns1")。

    以上是 PHP 作为 Oracle 客户端,必须做的。
    Navicat8.2 for Oracle 作为 Oracle 管理客户端,只要配置 oci 指向 D:\oracle_instantclient\instantclient_10_2\oci.dll,即可连接到 Oracle 数据库服务器。

    张庆(网眼) ,微博:http://t.qq.com/zhangking
    来自“网眼视界”:http://blog.why100000.com
    “十万个为什么”电脑学习网:http://www.why100000.com
     2013-2-6

 

Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn

Heiße KI -Werkzeuge

Undresser.AI Undress

Undresser.AI Undress

KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover

AI Clothes Remover

Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool

Undress AI Tool

Ausziehbilder kostenlos

Clothoff.io

Clothoff.io

KI-Kleiderentferner

AI Hentai Generator

AI Hentai Generator

Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

R.E.P.O. Energiekristalle erklärten und was sie tun (gelber Kristall)
2 Wochen vor By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Beste grafische Einstellungen
2 Wochen vor By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. So reparieren Sie Audio, wenn Sie niemanden hören können
3 Wochen vor By 尊渡假赌尊渡假赌尊渡假赌

Heiße Werkzeuge

Notepad++7.3.1

Notepad++7.3.1

Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version

SublimeText3 chinesische Version

Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1

Senden Sie Studio 13.0.1

Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6

Dreamweaver CS6

Visuelle Webentwicklungstools

SublimeText3 Mac-Version

SublimeText3 Mac-Version

Codebearbeitungssoftware auf Gottesniveau (SublimeText3)