仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1198|回复: 19
打印 上一主题 下一主题

[学习教程] PHP网页编程之php 毗连oracle:php oracle

[复制链接]
再现理想 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-2-3 23:31:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

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

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-11-16 11:14

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表