在PHP中连接到Oracle 10g [英] connect to oracle 10g in php

查看:121
本文介绍了在PHP中连接到Oracle 10g的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,
我知道在php中与mysql的连接.并且我使用mysql完成了几个项目.现在我想用php连接oracle 10g数据库.
我使用oci_connect(用户名,passwrd,数据库)与oracle连接,但显示错误致命错误:调用未定义的函数oci_connect()"是否可以帮助我有关如何与oracle和其他任何东西建立连接的信息添加以进行连接.

hi friends,
i know the connection with mysql in php. and i done several project using mysql. now i want to connect oracle 10g data base with php.
i use the oci_connect (username, passwrd, database) to connect with oracle, but it display error "Fatal error: Call to undefined function oci_connect()" can you help me about this how to make connection with oracle and any extra things i have to add for connection.
thanks in advance.

推荐答案

这些是PHP手册中oci_connect()的注释:

These are the notes to oci_connect() from the PHP manual:

Note: If you're using PHP with Oracle Instant Client, you can use easy connect naming method described here: » http://download-west.oracle.com/docs/cd/B12037_01/network.101/b10775/naming.htm#i498306. Basically this means you can specify "//db_host[:port]/database_name" as database name. But if you want to use the old way of naming you must set either ORACLE_HOME or TNS_ADMIN. 

Note: The second and subsequent calls to oci_connect() with the same parameters will return the connection handle returned from the first call. This means that queries issued against one handle are also applied to the other handles, because they are the same handle. This behaviour is demonstrated in Example 1 below. If you require two handles to be transactionally isolated from each other, you should use oci_new_connect() instead. 

Note: In PHP versions before 5.0.0 you must use ocilogon() instead. This name still can be used, it was left as the alias of oci_connect() for downwards compatability. This, however, is deprecated and not recommended. 


检查第一个和最后一个音符.它们适用于您吗?

彼得


[更新]

这是手册中的其他内容,内容涉及设置以使用OCI8(Oracle接口).


Check the first and last notes. Do they apply to you?

Peter


[update]

Here''s some more from the manual, about setting up to use OCI8 (the Oracle interface).

Requirements
You will need the Oracle client libraries to use this extension. Windows users will need libraries with version at least 10 to use the php_oci8.dll. 

Note: This extension does not support Oracle 8 client libraries anymore. Though you still can connect to Oracle 8 servers as long as the client library (v.9+) supports this. 


The most convenient way to install all the required files is to use Oracle Instant Client, which is available from here: » http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html. To work with OCI8 module "basic" version of Oracle Instant Client is enough. Instant Client does not need ORACLE_SID or ORACLE_HOME environment variables set. You still may need to set LD_LIBRARY_PATH and NLS_LANG, though. 

Before using this extension, make sure that you have set up your Oracle environment variables properly for the Oracle user, as well as your web daemon user. These variables should be set up before you start your web-server. The variables you might need to set are as follows: 

ORACLE_HOME 
ORACLE_SID 
LD_PRELOAD 
LD_LIBRARY_PATH 
NLS_LANG 
For less frequently used Oracle environment variables such as TNS_ADMIN, TWO_TASK, ORA_TZFILE, and the various Oracle globalization settings like ORA_NLS33, ORA_NLS10 and the NLS_* variables refer to Oracle documentation. 

[/update]

如果您需要更多帮助,强烈建议您下载PHP手册.

[/update]

If you need any more help, I strongly recommend that you download the PHP manual.


这篇关于在PHP中连接到Oracle 10g的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆