标题: PHP网页编程之php 毗连oracle:php oracle [打印本页] 作者: 再现理想 时间: 2015-2-3 23:31 标题: PHP网页编程之php 毗连oracle:php oracle 聪明的你,显然已经逐渐的开悟了,慢慢的理解了编程的概念,那么祝贺你,你已经迈出了成功的第一步。
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". 本文链接http://www.cxybl.com/html/wlbc/Php/20120531/27129.html参加PHP开发学习,或许只是一次偶然的想法吧!只是想在走向社会之前体验、学习在一个公司或者说是项目团队之中如何去更有效的沟通、交流、共同合作,还有就是为毕业实习找工作增加伐码。作者: 谁可相欹 时间: 2015-2-4 01:04
这些中手常用的知识,当你把我说的这些关键字都可以熟练运用的时候,你可以选择自己作者: 透明 时间: 2015-2-8 15:49
刚开始安装php的时候,我图了个省事,把php的扩展全都打开啦(就是把php.ini 那一片 extension 前面的冒号全去掉啦),这样自然有好处,以后不用再需要什么功能再来打开。作者: 海妖 时间: 2015-2-8 19:54
这些都是最基本最常用功能,我们这些菜鸟在系统学习后,可以先对这些功能深入研究。作者: 只想知道 时间: 2015-2-9 21:55
开发工具也会慢慢的更专业,每个公司的可能不一样,但是zend studio是个大伙都会用的。作者: 山那边是海 时间: 2015-2-27 22:35
php里的数组为空的时候是不能拿来遍历的;(这个有点低级啊,不过我刚被这个边界问题墨迹了好长一会)作者: 第二个灵魂 时间: 2015-3-9 14:47
有时候汉字的空格也能导致页面出错,所以在写代码的时候,要输入空格最好用引文模式。作者: 分手快乐 时间: 2015-3-16 23:51
Ps:以上纯属原创,如有雷同,纯属巧合作者: 蒙在股里 时间: 2015-3-23 07:03
在我安装pear包的时候老是提示,缺少某某文件,才发现 那群extension 的排列是应该有一点的顺序,而我安装的版本的排序不是正常的排序。没办法我只好把那群冒号加了上去,只留下我需要使用的扩展。作者: 不帅 时间: 2015-4-5 12:14
首推的搜索引擎当然是Google大神,其次我比较喜欢 百度知道。不过搜出来的结果往往都是 大家copy来copy去的,运气的的概率很大。作者: 金色的骷髅 时间: 2015-4-11 01:11
实践是检验自己会不会的真理。作者: admin 时间: 2015-5-6 04:08
环境搭建好,当你看见你的浏览器输出“it works\\\\\\\"时你一定是喜悦的。在你解决问题的时候,我强烈建议多读php手册。作者: 飘灵儿 时间: 2015-5-11 12:11
曾经犯过一个很低级的错误,我在文件命名的时候用了一个横线\\\\\\\'-\\\\\\\' 号,结果找了好几个小时的错误,事实是命名的时候 是不能用横线 \\\\\\\'-\\\\\\\' 的,应该用的是下划线 \\\\\\\'_\\\\\\\' ;作者: 变相怪杰 时间: 2015-5-12 06:13
php是动态网站开发的优秀语言,在学习的时候万万不能冒进。在系统的学习前,我认为不应该只是追求实现某种效果,因为即使你复制他人的代码调试成功,实现了你所期望的效果,你也不了解其中的原理。作者: 活着的死人 时间: 2015-5-12 09:26
其实没啥难的,多练习,练习写程序,真正的实践比看100遍都有用。不过要熟悉引擎作者: 愤怒的大鸟 时间: 2015-5-12 10:00
环境搭建好,当你看见你的浏览器输出“it works\\\\\\\"时你一定是喜悦的。在你解决问题的时候,我强烈建议多读php手册。作者: 柔情似水 时间: 2015-6-9 06:02
爱上php,他也会爱上你。作者: 再见西城 时间: 2015-6-11 18:47
学习php的目的往往是为了开发动态网站,phper就业的要求也涵盖了很多。我大致总结为:精通php和mysql作者: 小魔女 时间: 2015-6-13 00:23
当留言板完成的时候,下步可以把做1个单人的blog程序,做为目标,作者: 飘飘悠悠 时间: 2015-6-19 22:17
你很难利用原理去编写自己的代码。对于php来说,系统的学习我认为还是很重要的,当你有一定理解后,你可你针对某种效果研究,我想那时你不会只是复制代码的水平了。