|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
聪明的你,显然已经逐渐的开悟了,慢慢的理解了编程的概念,那么祝贺你,你已经迈出了成功的第一步。
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:
software
version
url
oracle database 10g express edition
10.2
http://www.oracle.com/technology/products/database/xe/
apache http server
2.0.58
http://httpd.apache.org/download.cgi
php hypertext processor
5.1.3
http://www.php.net/downloads.php
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". 本文链接http://www.cxybl.com/html/wlbc/Php/20120531/27129.html参加PHP开发学习,或许只是一次偶然的想法吧!只是想在走向社会之前体验、学习在一个公司或者说是项目团队之中如何去更有效的沟通、交流、共同合作,还有就是为毕业实习找工作增加伐码。 |
|