suchen
Heimphp教程php手册整合Oracle 10g、Apache 2.0、Php 5

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 基本介绍 2004 年 7 月 13 日 , PHP 官方站点正式发布了 PHP 5 。 Oracle 在 2004 年 8 月宣布将在拳头产品 Application Server 中提供对 PHP 的支持。先是在 Oracle Application Server 10g ( 9.0

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入

基本介绍

2004713PHP 官方站点正式发布了 PHP 5Oracle 2004 8 月宣布将在拳头产品 Application Server 中提供对 PHP 的支持。先是在Oracle Application Server 10g (9.0.4) 提供 mod_php 模块,继而在Oracle Application Server 10g Release 2 (10.1.2) 中提供了 PHP 4.3的版本,接着Oracle JDeveloper 10g 也将提供对 PHP 扩展能力。相信,不久Oracle将正式支持 PHP 5。而随着 Oracle 技术社区的大力推广,也将有更多的开发人员利用 PHP 进行大型数据库引用的开发。

OTN 上已经有文档描述如何进行 10g / HTTPD 1.3/ PHP 4 的整合。所以这篇文档将描述如何整合 Oracle 10gApache (httpd 2)PHP 5。便于快速的组建一个开发环境。如果您想对 PHP 的一些新功能(比如PDO)进行一下体验,那么本文可以作为一个开端。

OracleApachePHP三者之间的关系不妨借用一下这张示意图(原图地址)

整合Oracle 10g、Apache 2.0、Php 5

 

本文假定您的 Oracle 10g (服务器或者客户端)已经安装完毕。如果没有安装,请参考这篇文档:

http://www.dbanotes.nethttp://oracle.chinaitlab.com/Install-Oracle10g-RHEL3.htm

确定自己的 Oracle 处于可用状态。

本文所拥的操作系统为 Fedora Core 3 LinuxOracle 版本为10 R1 (10.1.0.2)

下载所需文件:HTTPD PHP 5

HTTPD - httpd://httpd.apache.org (目前的版本是 2.0.52)

PHP 5 - http://www.php.net (最新版本是 5.0.2)

安装HTTPD

需要说明的是,现在 Apache 社区不推荐把 Apache 2.0 用在产品环境中.

[root@FC3 software]# tar -zxvf httpd-2.0.52.tar.gz
[root@FC3 software]# cd httpd-2.0.52
[root@FC3 httpd-2.0.52]# ./configure --prefix=/usr/local/apache \
                         --enable-module=so
[root@FC3 httpd-2.0.52]# make clean
[root@FC3 httpd-2.0.52]# make
[root@FC3 httpd-2.0.52]# make install
[root@FC3 httpd-2.0.52]# /usr/local/apache/bin/apachectl start
[root@FC3 httpd-2.0.52]# /usr/local/apache/bin/apachectl stop

安装说明:第三行指定 Apache 的架构独立的文件安装位置。同时指定将用模块的形式。

如果为了方便的话,可以创建两个脚本控制 Apache 的启动与关闭。

[root@FC3 ~]# vi /bin/startapache

添加如下内容:

#!/bin/sh
ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1

ORACLE_SID=TEST
export ORACLE_HOME ORACLE_SID
echo Starting Apache
/usr/local/apache/bin/apachectl start

创建关闭 apache 的脚本:

[root@FC3 ~]# vi /bin/stopapache
添加如下内容:
#!/bin/sh
ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1

ORACLE_SID=TEST
export ORACLE_HOME ORACLE_SID
echo Starting Apache
/usr/local/apache/bin/apachectl stop
修改文件权限:
[root@FC3 ~] chmod +x /bin/startapache /bin/stopapache

安装 PHP 5

[root@FC3 software]# tar -xjf php-5.0.2.tar.bz2
[root@FC3 software]# cd php-5.0.2
[root@FC3 php-5.0.2]# export ORACLE_BASE=/u01/app/oracle
[root@FC3 php-5.0.2]# export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/db_1
[root@FC3 php-5.0.2]# export ORACLE_SID=TEST
[root@FC3 php-5.0.2]# export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
[root@FC3 php-5.0.2]# export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
[root@FC3 php-5.0.2]# ./configure --with-apxs2=/usr/local/apache/bin/apxs \
                      --with-oci8=$ORACLE_HOME
[root@FC3 php-5.0.2]# make clean
[root@FC3 php-5.0.2]# make
[root@FC3 php-5.0.2]# make install
[root@FC3 php-5.0.2]# cp php.ini-dist /usr/local/lib/php.ini

安装说明:第三到七行其实有些罗嗦了,其目的是控制 root 用户的环境变量,其实也可以直接在 root 用户的.bash_profile文件中制定环境变量。当然了,也可以用 oracle 用户来进行 configure make 。第八行中的 --with-oci8=$ORACLE_HOME 激活 oci8 支持。

接下来需要修改httpd.conf 文件的内容:

[root@FC3 php-5.0.2]# vi /usr/local/apache/conf/httpd.conf

添加如下内容:

LoadModule php5_module modules/libphp5.so

     AddType application/x-httpd-php .php

重新启动 apache:
[root@FC3 ]# /bin/stopapache
[root@FC3 ]# /bin/startapache
测试 PHP 模块
测试 PHP 模块是否已经可用。当然是标准办法,写一个包含如下内容的PHP页面 info.php:

从浏览器中查看该页面输出内容。

注意,该页面中的内容 Configure Command 那一行中的内容是否包括如下内容:

'--with-apxs2=/usr/local/apache/bin/apxs'
'--with-oci8=/u01/app/oracle/product/10.1.0/db_1'

注意:在测试之后,出于安全的考虑,请把该文件删除

测试 PHP oci

写一个简单的页面测试 oci 是否可用 (Just a copy sample from OTN)

$db_conn = ocilogon( "scott", "tiger","TEST" );

$cmdstr = "select ename, sal from emp";

$parsed = ociparse($db_conn, $cmdstr);
ociexecute($parsed);

$nrows = ocifetchstatement($parsed, $results);

echo "Oracle PHP Test";
echo "

Oracle PHP Test


";
echo "\n\\n";
echo "\n\n\n";

for ($i = 0; $i {
    echo "

\n";
    echo "
";
    echo "
";
    echo "
\n";

}

echo "

NameSalary
" . $results["ENAME"][$i] . "$ " . number_format($results["SAL"][$i],   2). "
Number of Rows: $nrows
";
echo "
If you see data, then it works!
\n";

?>

说明:上例中,scott/tiger分别为数据库的用户名字和密码,TEST为数据库连接串名字。

整合Oracle 10g、Apache 2.0、Php 5

Stellungnahme
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)
3 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Beste grafische Einstellungen
3 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. So reparieren Sie Audio, wenn Sie niemanden hören können
3 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: Wie man alles in Myrise freischaltet
4 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌

Heiße Werkzeuge

MinGW – Minimalistisches GNU für Windows

MinGW – Minimalistisches GNU für Windows

Dieses Projekt wird derzeit auf osdn.net/projects/mingw migriert. Sie können uns dort weiterhin folgen. MinGW: Eine native Windows-Portierung der GNU Compiler Collection (GCC), frei verteilbare Importbibliotheken und Header-Dateien zum Erstellen nativer Windows-Anwendungen, einschließlich Erweiterungen der MSVC-Laufzeit zur Unterstützung der C99-Funktionalität. Die gesamte MinGW-Software kann auf 64-Bit-Windows-Plattformen ausgeführt werden.

WebStorm-Mac-Version

WebStorm-Mac-Version

Nützliche JavaScript-Entwicklungstools

SecLists

SecLists

SecLists ist der ultimative Begleiter für Sicherheitstester. Dabei handelt es sich um eine Sammlung verschiedener Arten von Listen, die häufig bei Sicherheitsbewertungen verwendet werden, an einem Ort. SecLists trägt dazu bei, Sicherheitstests effizienter und produktiver zu gestalten, indem es bequem alle Listen bereitstellt, die ein Sicherheitstester benötigen könnte. Zu den Listentypen gehören Benutzernamen, Passwörter, URLs, Fuzzing-Payloads, Muster für vertrauliche Daten, Web-Shells und mehr. Der Tester kann dieses Repository einfach auf einen neuen Testcomputer übertragen und hat dann Zugriff auf alle Arten von Listen, die er benötigt.

Dreamweaver Mac

Dreamweaver Mac

Visuelle Webentwicklungstools

Sicherer Prüfungsbrowser

Sicherer Prüfungsbrowser

Safe Exam Browser ist eine sichere Browserumgebung für die sichere Teilnahme an Online-Prüfungen. Diese Software verwandelt jeden Computer in einen sicheren Arbeitsplatz. Es kontrolliert den Zugriff auf alle Dienstprogramme und verhindert, dass Schüler nicht autorisierte Ressourcen nutzen.