| 域名空间 下载中心 社区论坛 信息公告 my小屋 |
![]() |
联系我们 设为首页 加入收藏 |
|
首页 | 新闻资讯 | 编程开发 | 网页设计 | 图形图象 | 网络媒体 | 网站模板 | 数 据 库 | 投稿 论坛 | 操作系统 | 系统优化 | 网络安全 | 黑客技术 | 硬件学堂 | 硬件报价 | 服 务 器 | 地图 专题 | 应用软件 | 聊天通讯 | q q 专栏 | 建站经验 | 在线工具 | 站长club | 注 册 表 | 旧版 社会 | 游戏娱乐 | 设计欣赏 | 疑难解答 | 社区论坛 | 网络赚钱 | 网站地图 | 广告服务 | 服务 |
| 新版上线![旧版] | |||||
注:打开慢时请稍等
|
一. 准备工作 要实现将linux/apache/php4/fastcgi/oracle/mysql环境集成,必需先准备好以下软件包: (一)数据库的perl接口 1.perl5的oracle数据库dbi驱动程序:dbd-oracle-1.03.tar.gz 2.perl5的通用数据库接口程序:dbi-1.13.tar.gz 3.perl5的mysql数据库dbi驱动程序:msql-mysql-modules-1.2209.tar.gz (二)oracle数据库 4.oracle 8ir2(8.1.6) for linux安装盘:oracle8161.tar.gz (三)mysql数据库 5.mysql 3.22.32服务器程序包:mysql-3.22.32-1.i386.rpm 6.mysql客户端程序包:mysql-client-3.22.32-1.i386.rpm 7.mysql开发包(头文件/库文件):mysql-devel-3.22.32-1.i386.rpm 8.mysql共享库程序包:mysql-shared-3.22.32-1.i386.rpm (四)apache服务器 9.apache 1.3.12源码包:apache_1.3.12.tar.gz (五)php模块 10.php 4.0.0源码包:php-4.0.0.tar.gz (六)fastcgi模块 11.fastcgi模块源码包:mod_fastcgi_2.2.4.tar.gz 12.fastcgi的perl开发模块:fcgi-0.53.tar.gz 二. 安装oracle客户端 在此简单列出操作过程: (一)设置环境变量: 在/etc/profile中加入: export oracle_home=/opt/oracle8i/u01 export oracle_base=/opt/oracle8i export oracle_owner=oracle export oracle_sid=orcl export oracle_term=ansi export path=$path:$oracle_home/bin export ld_library_path=$oracle_home/lib export ora_nls33=$oracle_home/ocommon/nls/admin/data export nls_lang="simplified chinese_china.zhs16cgb231280" (二)建立oracle组和用户 #/usr/sbin/groupadd dba #/usr/sbin/useradd -g dba oracle #/usr/bin/passwd oracle (三)创建$oracle_home目录 #mkdir /opt #mkdir /opt/oracle8i #mkdir /opt/oracle8i/u01 #chown -r oracle.dba /opt (四)安装reacle 8ir2 以oracle用户登录,解开oracle安装包: $tar zxvf oracle8161.tar.gz $startx 启动xwindow界面,并打开一个rxvt终端窗口 $cd oracle8ir2 $./runinstaller 此时出现oracle安装界面,在安装时选择安装client/application user(如果oracle服务器不在本机上运行,另有专用机器),安装完毕后配置sql*net8并测试连接远程服务器通过即可。 三. 安装mysql服务器和客户端 #rpm -ivh mysql-3.22.32-1.i386.rpm #rpm -ivh mysql-client-3.22.32-1.i386.rpm #rpm -ivh mysql-devel-3.22.32-1.i386.rpm #rpm -ivh mysql-shared-3.22.32-1.i386.rpm 四. 安装perl的数据库接口模块 #tar zxvf dbi-1.13.tar.gz #cd dbi-1.13 #perl makefile.pl #make #make test #make install #cd .. #rm -rf dbi-1.13 # #tar zxvf dbd-oracle-1.03.tar.gz #cd dbd-oracle-1.03 #perl makefile.pl #make #make test #make install #cd .. #rm -rf dbd-oracle-1.03 # #tar zxvf msql-mysql-modules-1.2209.tar.gz #perl makefile.pl 选择1(mysql)和y(支持mysql.pm) #make #make test #make install # 五. 安装apache+php+fastcgi #tar zxvf apache_1.3.12.tar.gz #tar zxvf php-4.0.0.tar.gz #tar mod_fastcgi_2.2.4.tar.gz (二)编译php4 配置apache编译参数 #cd apache_1.3.12 #./configure --prefix=/usr/local/apache 配置php编译参数 #cd ../php-4.0.0 #./configure --with-apache=../apache_1.3.12 > --with-mysql > --with-oracle=$oracle_home > --with-oci8=$oracle_home > --enable-track-vars 编译php模块: #make #make install 创建php.ini参数文件 #cp php.ini-dist /usr/local/lib/php.ini #cd .. (三)添加fastcgi模块: #mv mod_fastcgi_2.2.4 apache_1.3.12/src/modules/fastcgi (四)编译安装apache #cd apache_1.3.12 配置编译参数 #./configure --prefix=/usr/local/apache > --activate-module=src/modules/php4/libphp4.a > --activate-module=src/modules/fastcgi/libfastcgi.a 编译apache #make 安装apache #make install (五)关闭原有系统自带的apache #/etc/rc.d/init.d/httpd stop (六)配置apache自身参数: 1.编辑/usr/local/apache/conf/httpd.conf文件,修改以下参数: servername host.mydomain.name documentroot "/home/httpd/html" options indexes followsymlinks multiviews includes allowoverride none order allow,deny allow from all scriptalias /cgi-bin/ "/home/httpd/cgi-bin/" allowoverride none options none order allow,deny allow from all directoryindex index.html index.phtml index.php index.htm index.shtml index.fcgi 2.修改自启动链接 #cd /etc/rc.d/init.d #ln -fs /usr/local/apache/bin/apachectl httpd (七)配置php4.0参数: 1.修改/usr/local/apache/conf/httpd.conf文件,修改以下参数: 增加一行:addtype application/x-httpd-php .php .phtml .php3 2.修改/usr/local/apache/bin/apachectl脚本,使启动支持中文oracle环境: 在文件中66行("start)")下面加入几行: export oracle_home=/opt/oracle8i/u01 export oracle_base=/opt/oracle8i export oracle_sid=orcl export ld_library_path=$oracle_home/lib export ora_nls33=$oracle_home/ocommon/nls/admin/data export nls_lang="simplified chinese_china.zhs16cgb231280" 3.修改/usr/local/apache/conf/srm.conf以在cgi程序中使用环境变量: passenv oracle_home passenv oracle_base passenv ld_library_path passenv nls_lang passenv oracle_sid passenv path (八)配置fastcgi执行环境: 1.修改/usr/local/apache/conf/httpd.conf文件,修改以下参数: 增加几行: ############ fastcgi configures begin ########################## addhandler fastcgi-script .fcg .fcgi .fpl sethandler fastcgi-script order deny,allow allow from all options execcgi indexes includes ############### fastcgi configure end ########################### 2.创建fcgi的执行目录 #mkdir /home/httpd/html/fcgi 3.安装fcgi的perl运行模块: #tar zxvf fcgi-0.53.tar.gz #cd fcgi-0.53 #perl makefile.pl #make #make install 六.启运并测试 #/etc/rc.d/init.d/httpd start 2.编写php测试程序: 第一个测试程序:/home/httpd/html/t1.php; 第二个测试php与oracle连接的php程序(表已经建好):查看是否为中文输出; 第三个测试php与mysql连接的php程序(表已经建好)。 3. 编写fastcgi的测试代码: /home/httpd/html/fcgi/test.fcgi #!/usr/bin/perl use fcgi; use dbi; $dbname="oracle"; $user="user"; $passwd="password"; $dbh=""; while(fcgi::accept()>=0) { &parse_form(); $id=$form{"id"}; $para=$form{"para"}; print "content-type: text/html "; print " "; if (!$dbh){ print "no oracle, need to connect "; $dbh = dbi->connect("dbi:oracle:$dbname",$user,$passwd); }else{ print "ok, oracle aleady connected "; } $sth=$dbh->prepare("select name from testtable where id=15"); $sth->execute; @recs=$sth->fetchrow_array; $sth->finish; print "参数id=".$id." and my name is @recs[0] "; print "参数para=".$para." "; } ####传入参数处理部分####### sub parse_form { my($buffer); my($pairs); my(@pairs); my($name); my($value); my $meth = $env{"request_method"}; if ($meth eq "get" || $meth eq "head") { $buffer = $env{"query_string"}; } elsif ($meth eq "post") { read(stdin, $buffer, $env{"content_length"}); } undef %form; @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fa-f0-9][a-fa-f0-9])/pack("c", hex($1))/eg; $value =~ s///g; if ($allow_html != 1) { $value =~ s/]| )*>//g; } $form{$name} = $value; } } 测试看看fastcgi是否正常执行了。 (转载自linuxaid) 原作者:张宏 编辑:黑鹰 [发送给好友] [打印本页] [关闭窗口] [返回顶部] 上一篇:接触 solaris : 安装 apache + php + mysql 下一篇:linux下快速安装“apache+php3+mysql” 转载请注明来源:www.iyit.net 特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。 |
| 最新更新 | 热点排行 | 推荐新闻 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
| 友情链接 | ||||||
| 设置首 页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接 |
| |||||||