系统升级后,所有的freebsd机器要改成linux机器,同事安装一台linux机器,换掉其中的一台freesbd系统的机器(该机器是realserver),换掉后,cgi执行有问题! 当调度机将请求调度到这台机器上时,不能处理cgi,提示下载,显然不支持cgi!
解决方法:在httpd.conf中加入:
LoadModule cgi_module modules/mod_cgi.so 使其支持cgi 然后重启apache使之生效!
然后我又升级了perl版本,由原来的perl5.8.5 升级到perl5.8.8
过程如下:下载perl-5.8.8.tar.gz
tar zxcf perl-5.8.8.tar.gz
cd perl-5.8.8
./Configure -des -Dprefix=/usr/local/perl5
make
make test
make install
将软件安装后!
[root@qht124 ~]# which perl
/usr/bin/perl
cd /usr/bin
mv perl perl.bak
ln -s /usr/local/perl5/bin/perl perl
接着核查perl的版本:
[root@qht124 ~]# perl -v
This is perl, v5.8.8 built for i686-linux
Copyright 1987-2006, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at , the Perl Home Page.
也可以使用一个最简单的程序来测试:程序如下:
-
[root@IDC-D-2520 ****]# which perl
-
/usr/bin/perl
-
[root@IDC-D-2520 ****]# perl -v
-
-
This is perl, v5.8.8 built for i686-linux
-
-
Copyright 1987-2006, Larry Wall
-
-
Perl may be copied only under the terms of either the Artistic License or the
-
GNU General Public License, which may be found in the Perl 5 source kit.
-
-
Complete documentation for Perl, including FAQ lists, should be found on
-
this system using "man perl" or "perldoc perl". If you have access to the
-
Internet, point your browser at the Perl Home Page.
-
[root@IDC-D-2520 ****]# cat test.pl
#!/usr/bin/perl -w
use warnings;
print "Hello, Perl works! ";
-
[root@IDC-D-2520 ****]# perl test.pl
-
Hello, Perl works!
显然已经升级为perl5.8.8 , 尽管软件已经升级成功,但原来的perl module却不能被使用!
在浏览器中运行用户的cgi ,
提示Can't locate DBI.pm in @INC (@INC contains: ******
google下,发现缺少perl-DBI包,开始试图用rpm包来安装,由于rpm包较强的依赖性,安装失败了!
在网上找到一直安装方法:
#perl -MCPAN -e shell
经过一系列的回车终于到cpan>了,在这个过程中遇到的问题是,我没有安装ncftp,下载ncftp-3.0.0-src.tar.bz2解压安装,否则会一直提示找不到ncftpget命令,见附件
下载安装ncftp就可以了!
看到cpan>就可以安装了!
cpan>install DBI
cpan>install DBD::mysql ##安装这个软件的时候,需要耐心等待
这里安装出错:
-
dbdimp.c: In function `mysql_db_async_result':
-
dbdimp.c:5023: error: `h' undeclared (first use in this function)
-
dbdimp.c:5025: error: `MYSQL' undeclared (first use in this function)
-
dbdimp.c:5025: error: `svsock' undeclared (first use in this function)
-
dbdimp.c:5026: error: `MYSQL_RES' undeclared (first use in this function)
-
dbdimp.c:5026: error: `_res' undeclared (first use in this function)
-
dbdimp.c:5027: warning: ISO C90 forbids mixed declarations and code
-
dbdimp.c:5030: error: `resp' undeclared (first use in this function)
-
dbdimp.c:5041: error: dereferencing pointer to incomplete type
-
dbdimp.c:5045: error: dereferencing pointer to incomplete type
-
dbdimp.c:5049: error: dereferencing pointer to incomplete type
-
dbdimp.c:5053: error: dereferencing pointer to incomplete type
-
dbdimp.c:5055: error: dereferencing pointer to incomplete type
-
dbdimp.c:5061: warning: passing arg 3 of `mysql_dr_error' makes pointer from integer without a cast
-
dbdimp.c:5072: error: dereferencing pointer to incomplete type
-
dbdimp.c:5074: error: `my_ulonglong' undeclared (first use in this function)
-
dbdimp.c:5076: error: dereferencing pointer to incomplete type
-
dbdimp.c:5082: error: dereferencing pointer to incomplete type
-
dbdimp.c:5082: error: dereferencing pointer to incomplete type
-
dbdimp.c:5083: error: dereferencing pointer to incomplete type
-
dbdimp.c:5084: error: dereferencing pointer to incomplete type
-
dbdimp.c:5087: error: dereferencing pointer to incomplete type
-
dbdimp.c:5091: warning: passing arg 3 of `mysql_dr_error' makes pointer from integer without a cast
-
dbdimp.c: In function `mysql_db_async_ready':
-
dbdimp.c:5110: error: dereferencing pointer to incomplete type
-
dbdimp.c:5114: error: dereferencing pointer to incomplete type
-
dbdimp.c:5115: error: dereferencing pointer to incomplete type
-
dbdimp.c:5119: error: dereferencing pointer to incomplete type
-
{standard input}: Assembler messages:
-
{standard input}:31: Warning: size of "use_mysql_use_result" is already 1; not changing to 4
-
make: *** [dbdimp.o] Error 1
-
/usr/bin/make -- NOT OK
-
Running make test
-
开始:我怀疑没有安装zlib-devel包,查证后发现该包已经安装!
-
后来终于找到原因:原来是没有配置mysql的路径
-
在.bashrc中加入:
-
export PATH=/usr/local/mysql5/bin:/usr/local/php5/bin/:/usr/local/apache2/bin/:$PATH
-
问题即可解决
-
安装完成后,不再提示Can't locate DBI.pm in @INC (@INC contains: ****** , 打依然有问题,错误提示:
Can't locate MD5.pm **** , 查了下,缺少perl下的MD5模块
见附件
解决方法:
老外提供的方法:
As you will have root-access on your computer, it should be easy:
root@computer# cpan
cpan shell -- CPAN exploration and modules installation (v1.7601)
ReadLine support enabled
cpan> install MD5
....
/usr/bin/make install -- OK
cpan> exit
If you haven't used the CPAN-shell before, it will ask you some
questions about the settings. The defaults will be OK in most cases.
If you haven't the "cpan" executable in your PATH, you can also run it
like this:
perl -MCPAN -e shell
cpan>install MD5
问题即可解决!
查找已经安装的perl模块方法:
[]#perldoc perllocal
显示见附件:
还有另外一种安装方式:
在处理兆维机房的机器时,有上面的安装方式,会提示失败! 一直都安装不上,
只好从网上软件来安装!
安装DBI,我下载的是DBI-1.616.tar.gz
tar zxvf DBI-1.616.tar.gz
cd DBI-1.616
perl Makefile.PL
make
make test
make install
安装好的软件,在
-
[root@localhost xncenter]# cd /usr/local/perl5/
-
[root@localhost perl5]# ls
-
bin lib man
-
[root@localhost perl5]# cd lib/
-
[root@localhost lib]#
-
[root@localhost lib]# ls
-
5.8.8 site_perl
-
[root@localhost lib]# find . -name DBI
-
./site_perl/5.8.8/i686-linux/auto/DBI
-
./site_perl/5.8.8/i686-linux/DBI
-
[root@localhost lib]#
然后安装DBD-mysql-4.016.tar.gz
tar zxvf DBD-mysql-4.016.tar.gz
cd DBD-mysql-4.016
perl Makefile.PL
make
make test
make install
即可安装!
安装后查看是否已经安装:
-
[root@localhost DBD-mysql-4.016]# cd /usr/local/perl5/
-
[root@localhost perl5]# ls
-
bin lib man
-
[root@localhost perl5]# cd lib/
-
[root@localhost lib]# ls
-
5.8.8 site_perl
-
[root@localhost lib]# find . -name mysql
./site_perl/5.8.8/i686-linux/auto/DBD/mysql
./site_perl/5.8.8/i686-linux/DBD/mysql
或者使用这种方式:
-
[root@localhost ~]# perl -e 'use DBI;'
-
[root@localhost ~]# perl -e 'use DBD::mysql;'
如果机器上已经安装了DBI和DBD::mysql模块,执行上面两句不会有输出,如果没有安装就会出错:
如下附件:
cgi处理过程中遇到的问题:
1:支持perl hello.cgi运行正常,而在...中家人ScriptAlias /cgi-bin/ /usr/vhome/a/b/c/abc.com/cgi-bin/ hello.cgi就在
/usr/vhome/a/b/c/abc.com/cgi-bin/目录下,但在浏览器中 ##已经做了本地解析,提示如下:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
故障原因:hello.cgi缺少x权限!
解决方法:chmod a+x hello.pl
2:还遇到一个奇怪的问题:
在httpd.conf中加入:
RLimitCPU 6 6
RLimitMEM 8000000 8000000导致apache不能正常处理cgi
将这两行删除即可
在公司处理过的一个问题!
现在修改后,我们的61.155.15*.165机器已经能正常执行cgi脚本!
开始由于61.155.15*.183机器上httpd.conf'中不支持cgi, 造成165
集群上调度到183机器上,就不能正常执行!
已经进行如下修改:添加
LoadModule cgi_module modules/mod_cgi.so 使其支持cgi
并在机器上升级php5.8.5 到php5.8.8 ##这个其实没有必要
安装ncftpget (为了安装perl的模块),已经安装perl相关模块
现在做本地解析到61.155.15*.183 ,测试已经正常,见附件!
还有如果用户需要支持cgi的运行, 我们需要在配置文件里增加alias,例如: ##* is b
的设置,
ScriptAlias /cgi-bin/ /vhost/l/a/-/la-b*s.com/cgi-bin/
在/vhost/l/a/-/la-b*s.com 目录下mkdir cgi-bin
用户将自己的cgi程序放到这个目录下,就可以看使用了!
perl安装模块:
安装一个模块:
# perl -MCPAN -e 'install version'
#perl
-MCPAN -e 'install NetAddr::IP'
#perl
-MCPAN -e 'install Mail::SPF'
#perl
-MCPAN -e 'install Sys::Hostname::Long'
或者:
perl -MCPAN -e shell
》install version
》install NetAddr::IP
》install Mail::SPF
》install Sys::Hostname::Long
当使用上面的方法安装时有时候会有如下的提示:
[root@ID17342 bakwebdb]# perl -MCPAN -e shell
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
1. Check whether you have 'perl-CPAN‘ package installed in your system.
For checking ‘perl-CPAN’ package run following in your shell.
[root@host13 ~]# rpm -q perl-CPAN
If perl-CPAN package is installed, you will get the output like this
perl-CPAN-1.9402-116.fc13.i686
else, you will get output like this
package perl-CPAN is not installed
解决方法:
yum -y install perl-CPAN
Warning (usually harmless): 'YAML' not installed, will not store persistent state
阅读(3317) | 评论(0) | 转发(0) |