centos系统自带perl版本过旧可能导致程序出现问题
升级方法:官网:http://www.perl.org/
直接采用二进制方法安装
tar xzvf ActivePerl-5.14.2.1402-i686-linux-glibc-2.3.6-295342.tar.gz
cd ActivePerl-5.14.2.1402-i686-linux-glibc-2.3.6-295342
sh install.sh (安装在/opt目录下)
——————源码安装————
wget http://www.cpan.org/src/5.0/perl-5.14.2.tar.gz
tar zxvf perl-5.14.2.tar.gz
cd perl-5.14.2
sh Configure -de
make
make test
make install
安装完成后 perl 所在目录为 /usr/local/lib/perl5, perl 执行文件在 /usr/local/bin 中。
——————替换系统旧版本perl——————
mv /usr/bin/perl /usr/bin/perl58 #将原有旧版perl重命名为perl58
ln -s /usr/local/bin/perl /usr/bin/perl #将新版perl软链接到原处,之前安装的模块需要重新安装
备选:/etc/yum.conf:
exclude=perl
#免除perl更新 避免未来可能发生的错误
——————更新后运行perl程序出错 提示找不到syscall.ph文件——————
#Can't locate syscall.ph(用h2ph命令查找)
whereis h2ph
cd /usr/include; h2ph -r -l #将perl5.8的lib目录下ph文件复制到新安装处
——————为cgi(pl)程序设置path_info——————
好在,0.7.31 版本以上的 Nginx 新增了fastcgi_split_path_info 这个指令,现在配置起来清晰多了:
location ~ ^(.+\.cgi)(.*)$ {
root /www/test;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.cgi)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass unix:/tmp/php-fpm.sock;
include fastcgi_params;
}
}
指令的具体帮助请参考官方WIKI:
http://wiki.nginx.org/NginxHttpFcgiModule#fastcgi_split_path_info
参考:
基于CentOS搭建nginx+perl(CGI)的perl(CGI)环境
https://bbs.zephyrxt.com/thread-8934-1-1.html
Perl 5.10.0升级及替换系统自带版本
https://bbs.zephyrxt.com/thread-8933-1-1.html
nginx支持path_info
https://bbs.zephyrxt.com/thread-8930-1-1.html
nginx设置path_info
https://bbs.zephyrxt.com/thread-8929-1-1.html
Nginx and Perl-FastCGI on CentOS 5
https://bbs.zephyrxt.com/thread-8925-1-1.html
install Perl in linux from source (src) readme
https://bbs.zephyrxt.com/thread-8937-1-1.html