Are you ready to start using PHP to talk to an Oracle Database? Let's walk through the steps required to install the Oracle Database, Apache HTTP Server, and PHP as an Apache module on Windows. We will be using Windows XP Professional for this example.
Software Requirements:
Installing Oracle
You have a choice here. You may either install the database locally on this Windows machine, or you may decide to use an Oracle server located on another machine on your network. If your database is remote, jump to the article on Installing PHP and the Oracle 10g Instant Client for Linux and Windows.
Otherwise, if this is your first time with Oracle, installing the Oracle Database 10g Express Edition only takes a few minutes. Download the Express Edition (commonly known as "XE") self-extracting executable OracleXE.exe and simply double-click this file to run the installation wizard.
Starting and Stopping Oracle
Oracle XE will be running after installation. You can test it by opening your browser to the Database home page http://localhost:8080/apex/. Use the username "SYSTEM" and the password you chose during installation.
Note: You may need to replace "localhost" with the IP address 127.0.0.1 or your machine's DNS name if you are behind a firewall or if localhost does not resolve for some other reason.
If you need to restart the database at any time use the Start Database and Stop Database items on the Windows Start menu.
Don't forget to register for the free Oracle XE forum by following the "Forum Registration" link on the Database home page.
Installing Apache HTTP Server
The easiest way to install Apache on Windows is to download the Microsoft Windows Installer apache_2.0.58-win32-x86-no_ssl.msi package from Apache Windows Binaries. To install on this machine, double-click the file and follow the wizards. I chose to install "for All Users, on Port 80" because the "only for the Current User" alternative would clash with Oracle XE's default port 8080. I installed Apache under C:\Program Files\Apache Group, however any other directory will also work.
Starting and Stopping Apache
As part of installation, the server will be started. You should now test on your machine by opening your web browser to http://localhost/
Your system tray has an Apache Monitor control that makes it easy to stop and re-start the HTTP Server when needed. Alternatively use the Apache options added to your Windows Start menu.
Installing PHP
Download the PHP 5.1.3 Zip package (not the "installer" package, which does not contain necessary extensions). You will notice that the installation instructions here are very similar to those found in the install.txt file contained within the PHP archive that you downloaded. Feel free to use that as a guide; the instructions here are just a subset of the information it contains.
Installation Steps
-
Uncompress the PHP package to a directory called "C:\php-5.1.3-Win32".
-
Copy php.ini-recommended to C:\Program Files\Apache Group\Apache2\conf\php.ini
-
Edit php.ini and perform the following:
- Change extension_dir to "C:\php-5.1.3-Win32\ext", which is the directory containing php_oci8.dll and the other PHP extensions.
- Uncomment (remove the semicolon from the beginning of the line) the line extension=php_oci8.dll
- For testing it is helpful to set display_errors to On so you see any problems in your code.
- Edit the file httpd.conf and add the following lines. Make sure to use forward slashes '/' instead of back slashes '\':
#
# This will load the PHP module into Apache
#
LoadModule php5_module c:/php-5.1.3-Win32/php5apache2.dll
#
# This next section will call PHP for .php, .phtml, and .phps files
#
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
#
# This is the directory containing php.ini
#
PHPIniDir "C:/Program Files/Apache Group/Apache2/conf"
Restart the Apache HTTP Server
You must now restart the Apache Server so that you can test your PHP installation. Use the Start menu option to start Apache. This opens a console window showing any error messages. They may also be recorded in C:\Program Files\Apache Group\Apache2\logs\error.log
If you have errors, double check your httpd.conf and php.ini and correct any problems.
Testing Apache and PHP with Oracle
Testing PHP with Oracle is easy. You simply need to place a PHP file into your htdocs directory; normally C:\Program Files\Apache Group\Apache2\htdocs.
Here are two files, the first is used to test basic PHP installation. Open it in a browser with http://localhost/phpinfo.php. If PHP is installed you should see a large page full of PHP configuration information.
phpinfo.php
<?php
phpinfo();
?>
Check there is a section titled "oci8".
分享到:
相关推荐
### PHP Oracle 学习手册知识点概述 #### 一、引言 《PHP Oracle学习手册》是一本详尽介绍PHP与Oracle数据库系统合作与使用的专业书籍。该书由Christopher Jones和Alison Holloway合著,发布于2008年12月,版本为...
压缩包中的"PHPOracle.pdf"很可能是详细的PHP与Oracle开发教程,可能涵盖上述所有知识点的实例和深入解析,建议仔细阅读。 综上所述,PHP与Oracle的结合使用涵盖了数据库连接、查询、事务处理、错误处理、PL/SQL...
本文将深入探讨“PHP Oracle 数据库操作类”,这是一个专为PHP设计的类,用于连接和操作Oracle数据库。 PHP是一种广泛使用的开源脚本语言,常用于Web开发,而Oracle则是一款强大的关系型数据库管理系统(RDBMS),...
### PHP与Oracle Web开发关键技术详解 #### 一、概述 本书《PHP Oracle Web Development: Data Processing, Security, Caching, XML, Web Services, and Ajax》由Yuli Vasiliev撰写,于2007年8月出版,共392页。...
在Ubuntu系统上安装PHP与Oracle数据库的连接模块是一项常见的任务,尤其对于那些需要在Linux环境中构建基于PHP的应用程序并与Oracle数据库交互的开发者来说。本文将详细介绍如何在Ubuntu上配置PHP以支持Oracle数据库...
在Linux环境下为PHP安装Oracle扩展是一项常见的任务,特别是在需要与Oracle数据库进行交互的Web应用程序中。Oracle数据库以其稳定性、安全性和高性能而闻名,因此许多企业选择它作为后端存储。PHP作为广泛使用的...
在IT行业中,PHP和Oracle是两个非常重要的技术组件。PHP是一种广泛使用的开源脚本语言,尤其在Web开发中占据主导地位,而Oracle则是一款强大的关系型数据库管理系统,被许多大型企业和组织信赖。当需要在PHP应用程序...
Oracle PHP代码生成器, 一个强大的Oracle GUI程序,用于生成高质量的Oracle PHP代码, 无论是个人学习还是研究,都是一款很不错的工具,尤其是能为Oracle生成高质量的代码,还提供了大量的模板和范例,值得玩味。
在IT行业中,构建高效稳定的Web服务常常涉及到多个组件的集成,比如`nginx`、`php`和`oracle`。这个组合通常用于构建一个强大的后端系统,能够处理大量的并发请求,执行复杂的PHP脚本,并与Oracle数据库进行高效的...
### PHP与Oracle数据库结合使用的关键知识点 #### 一、PHP简介 PHP是一种广泛使用的开源脚本语言,尤其适合Web开发并可嵌入HTML中。它的一些主要特点包括: - **最流行的脚本语言**:PHP是当前最常用的脚本语言之一...
【PHP+Oracle网站案例-捡宝】是一个使用PHP编程语言与Oracle数据库系统构建的网站项目。这个案例展示了如何将这两种技术有效地结合起来,为用户提供服务。PHP(Hypertext Preprocessor)是一种广泛使用的开源脚本...
1 安装apr 2安装apr-util 3安装pcre 4安装apache 5.安装php 修改php.ini配置文件 修改apache配置文件支持php
### Windows Server 2008 64位环境下PHP连接Oracle数据库详解 #### 一、概述 在Windows Server 2008 64位环境下使用PHP连接Oracle数据库是一项常见需求,尤其对于需要进行跨平台数据处理的应用而言更是如此。本...
**PHP+ORACLE留言板系统详解** 在Web开发中,构建留言板功能是一项常见的需求,它可以用于用户之间的交流或者接收用户对网站的反馈。本系统以PHP作为服务器端脚本语言,Oracle作为后台数据库,构建了一个简单易用的...
《操作Oracle的PHP类》是用于在PHP环境中与Oracle数据库进行交互的一个实用工具类,它提供了多种数据库操作方法,简化了开发过程中的数据库操作。这个类由作者天灰编写,最后一次更新日期为2001年5月11日。在类的...
在进行AJAX+PHP+Oracle数据库的Web开发时,开发者会利用AJAX技术与用户进行异步交互,通过PHP脚本与Oracle数据库通信,从而实现动态网站的应用需求。例如,在一个典型的电子商务网站中,使用AJAX技术可以实现在不...
本文档概述了如何在 Linux 下安装 Oracle 10g 数据库、HTTP 服务器(Apache)以及 PHP,并介绍了如何让 PHP 连接到 Oracle 数据库。这些步骤是构建一个完整 Web 应用程序环境的基础,适用于开发和部署基于 PHP 和 ...
在本文中,我们将深入探讨如何使用PHP与Oracle数据库进行交互,特别是实现分页显示数据的功能。首先,我们有一个名为`ora_sql`的PHP类,该类封装了与Oracle数据库的基本操作,包括连接、执行SQL语句以及获取查询结果...
基于PHP+Oracle实现的许愿墙网站。服务器部署后,可进行祝福信息发布展示,许愿登功能。