2009-8-22

apache的“软链接”命令alias

ln -s,大家都经常用的linux下“创建快捷方式”的命令。用ln -s做的软链接经常给人许多方便。有人甚至想,在apache的DocumentRoot之内之外也可以这样。很多年前,我就是这样想的。好笨哦。其实,用apache的Alias指令就可以了。

Alias指令
说明:映射URL到文件系统的特定区域
语法:Alias URL-path file-path|directory-path
作用域:server config, virtual host

Alias到DocumentRoot之内之外都可以的,只不过Alias到DocumentRoot之外的话可能需要明确的对目标目录设定访问权限。除了目标目录需要真的存在外,在DocumentRoot之内并不真的需要有URL-path对应的目录存在。

PHP Notice: Undefined variable: PHP_SELF in...

日志里有很多PHP Notice: Undefined variable: PHP_SELF in...及其他类似信息,但php写的网页似乎都正常工作。不想在这些无关痛痒的信息找真正的出错信息,于是修改/etc/php.ini,将默认的
error_reporting = E_ALL注释掉,即改成;error_reporting = E_ALL
把;error_reporting = E_ALL & ~E_NOTICE前面的;去掉。然后重启apache
service httpd restart

apache日志定制与rotatelogs日志滚动

有问题,查apache的access_log和error_log。可以修改http.conf不仅可以确定这些日志放的地方与输出格式,还能滚动日志。以前在日本时,组里的那个服务器日志不滚动。error_log大到好几个G,当时不会tail,下载到windows上费时不说,无论用什么软件去打开都是一个死字。到后来发现,linux下,其实是solaris,都差不多啦,一个小小的tail命令就搞定了,开始对整个unix体系刮目相待。shell下,man rotatelogs,

我喜欢的
ErrorLog "|/usr/sbin/rotatelogs /bu/gaoshuni/logs/error_log-%Y%m%d 5M"
每满5M大小生成一个新的error_log-某年某月某日


CustomLog "|/usr/sbin/rotatelogs /bu/gaoshuni/logs/access_log-%Y%m%d 86400" common
每天产生一个新的access_log-某年某月某日

2009-8-21

前段时间常见问题总结

1. 很多问题都是SELinux造成的。安全与方便易用成反比。
2. 路径和权限
要注意区分本机硬盘上文件系统的绝对路径与相对路径及在网络上的绝对路径与相对路径。
3. 在原来服务器上,java applet放在cgi-bin目录可以用。但在现在的服务器上,apache 认为"/cgi-bin/" 目录下的所有文件都是cgi 程序,并试图去执行它,对/cgi-bin/目录下的javaapplet的访问调用出错。如[error] Unrecognized character \\x03 in column 221 at JavaApplet.jar line 1.\n
4. perl中调用系统中第三方程序时,可能需要修改其shell脚本。如naccess,必须先到有读写权限的目录,否则其最后一段脚本(见下)不能完成,将引起错误。
#
# write input file
#
echo "PDBFILE $PDBFILE" >! accall.input
echo "VDWFILE $VDWFILE" >> accall.input
echo "STDFILE $STDFILE" >> accall.input
echo "PROBE $probe" >> accall.input
echo "ZSLICE $zslice" >> accall.input
if ( $hets ) then
echo "HETATOMS" >> accall.input
endif
if ( $wats ) then
echo "WATERS" >> accall.input
endif
if ( $hyds ) then
echo "HYDROGENS" >> accall.input
endif
if ( $full ) then
echo "FULL" >> accall.input
endif
if ( $asao ) then
echo "ASAONLY" >> accall.input
endif
if ( $cont ) then
echo "CONTACT" >> accall.input
endif
if ( $oldr ) then
echo "OLDRSA" >> accall.input
endif
if ( $nbac ) then
echo "CSIDE" >> accall.input
endif
#
# run accessibility calculations
#
$EXE_PATH/accall < accall.input
#
# delete temporary input file
#
\rm accall.input
#naccess_end

CPAN,赞一个

原来在windows下使用activestate perl时,觉得老的ppm还是不错的(新的图形用户界面的ppm,感觉比较慢)。前段时间要把原来在国外服务器上的一些perl程序移到我们教育网的服务器上,需要安装bioperl以及其它一些perl模块。于是准备先安装cpan。下载了相应rpm包来安装,结果出错。换了几个rpm包,错误都差不多。
rpm -Uvh perl-CPAN-1.9205-68.fc10.x86_64.rpm
error: Failed dependencies:
perl = 4:5.10.0-68.fc10 is needed by perl-CPAN-0:1.9205-68.fc10.x86_64

rpm -Uvh perl-CPAN-1.9205-49.fc10.x86_64.rpm
error: Failed dependencies:
perl = 4:5.10.0-49.fc10 is needed by perl-CPAN-0:1.9205-49.fc10.x86_64


perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:...

真不知道该如何是好,没办法,只好下载了cpan源代码,然后编译安装。成功。这下好了。命令行下输入cpan
进入cpan shell

cpan[1]>d /bioperl/

Distribution BIRNEY/bioperl-1.2.2.tar.gz
Distribution BIRNEY/bioperl-1.2.3.tar.gz
Distribution BIRNEY/bioperl-1.2.tar.gz
Distribution BIRNEY/bioperl-1.4.tar.gz
Distribution BIRNEY/bioperl-db-0.1.tar.gz
Distribution BIRNEY/bioperl-ext-1.4.tar.gz
Distribution BIRNEY/bioperl-gui-0.7.tar.gz
Distribution BIRNEY/bioperl-run-1.4.tar.gz
Distribution BOZO/Fry-Lib-BioPerl-0.15.tar.gz
Distribution CJFIELDS/BioPerl-1.6.0.tar.gz
Distribution CJFIELDS/BioPerl-db-1.6.0.tar.gz
Distribution CJFIELDS/BioPerl-network-1.6.0.tar.gz
Distribution CJFIELDS/BioPerl-run-1.6.1.tar.gz
Distribution CRAFFI/Bundle-BioPerl-2.1.8.tar.gz
14 items found

cpan[2]>install CJFIELDS/BioPerl-1.6.0.tar.gz
.......
之后遇到很多各类perl模块的安装,install ... 无比简单。CPAN,赞一个!