tomcat8支持CGI
一、环境windows server 2003R2 tomcat8 PHP5 MySQL5
很多文档要求将server/lib下servlets-cgi改名为servlets-cgi.jar。从6版本以后,好像就没有server目录,内部已经自动支持cgi,只需要进行配置即可。
Tomcat需要JDK 1.6以上,所以JDK需要先安装好。
二、配置步骤:
1、到C:\php-5.3.10-Win32-VC9-x86目录下将php.ini-development复制一份同一目录下,命名为php.ini
设置extension_dir参数:
extension_dir="C:\php-5.3.10-Win32-VC9-x86\ext"
设置cgi.force_redirect参数:
cgi.force_redirect = 0
2、修改tomcat配置文件
修改conf/web.xml,找到并将cgi的servlet和servlet-mapping的注释去掉
cgi
org.apache.catalina.servlets.CGIServlet
debug
0
executable
C:\php-5.3.10-Win32-VC9-x86\php-cgi.exe
passShellEnvironment
true
cgiPathPrefix
WEB-INF/..
5
cgi
*.php
修改conf/context.xml
修改默认网站根目录conf/server.xml
三、测试
建立index.php文件
http://10.0.1.11:8080/index.php
不出意外应该能看到PHP的测试页
本文参考
http://blog.csdn.net/ge_zhiqiang/article/details/6602511
http://www.cnblogs.com/top5/archive/2012/11/29/2794036.html
页:
[1]