Tomcat运行PHP项目
来源:互联网 发布:淘宝全球购在哪里 编辑:程序博客网 时间:2024/06/07 04:02
本文记录如何在windows环境中将php项目部署在tomcat下。不懂php语言,偶然一次需要把php部署在tomcat下,经过网上搜索部署成功,记录一下。
1、下载安装xampp,下载地址 https://www.apachefriends.org/download.html。
2、设置xampp环境变量。
3、cmd运行php -v,安装成功。
4、Tomcat环境。解压缩Tomcat压缩包到指定位置,我使用的版本是 apache-tomcat-7.0.70
5、修改Tomcat下conf下的web.xml,添加如下内容。
<servlet> <servlet-name>php</servlet-name> <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class> <init-param> <param-name>clientInputTimeout</param-name> <param-value>200</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>executable</param-name> <param-value>C:\xampp\php\php-cgi.exe</param-value> </init-param> <init-param> <param-name>passShellEnvironment</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>cgiPathPrefix</param-name> <param-value>WEB-INF/php</param-value> </init-param> <load-on-startup>5</load-on-startup> </servlet> <servlet-mapping> <servlet-name>php</servlet-name> <url-pattern>/php/*</url-pattern> </servlet-mapping>6、修改Tomcat下conf下的context.xml,把<Context >标签添加 privileged="true" ,修改后<Context privileged="true">。
7、在Tomcat下的webapps\ROOT\WEB-INF新建php文件夹,新建index.php,文件内容为
<?php phpinfo();?>
8、启动tomcat,本机浏览器访问,如果页面出现如下内容This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.
For more information as to why this behaviour exists, see the manual page for CGI security.
For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.
进入xampp安装目录下,进入php目录,修改php.ini ,将 ;cgi.force_redirect = 1 修改为 cgi.force_redirect = 0
9,访问页面如下,部署成功
10,如果遇到启动提示丢失VCRUNTIME140.DLL,可以下载点击下载 安装即可。
- Tomcat运行PHP项目
- tomcat中运行PHP项目
- 配置tomcat以运行PHP项目
- php项目运行到tomcat上
- 配置tomcat以运行PHP项目
- 配置tomcat以运行PHP项目
- 配置tomcat以运行PHP项目
- tomcat部署php项目
- 在tomcat上运行php
- 在tomcat中运行php
- 在tomcat上运行php
- Ubuntu下tomcat运行PHP
- 运行项目Tomcat报错
- 使用tomcat运行项目 IDEA
- idea+tomcat+tomcat运行项目(一)
- Tomcat直接部署PHP项目
- PHPStorm 配置运行PHP项目
- PHPStorm 配置运行PHP项目
- qq、短信第三方
- C语言的int, float,double相互转化(从本质上理解可能的问题)
- 223. Rectangle Area
- java制作倒计时
- 深入理解js的变量提升和函数提升
- Tomcat运行PHP项目
- java ajax异步上传文件(文档、图片都可以)
- MFC——编辑控件的7种方法
- 【DOM 编程艺术】3.4 节点
- tomcat 与 nginx,apache的区别
- 表单标签2
- java网络编程--URLEncode和URLDecoder
- hibernate_检索(查询)简介
- 巧用CAS解决数据并发一致性问题