Tomcat 8 上的 PHP

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20634598/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:21:33  来源:igfitidea点击:

PHP on Tomcat 8

phpapachetomcatwebservertomcat8

提问by user2227904

I had found quite a few guides how to make PHP run on Tomcat, but all were on previous versions. I tried all of them and all I could manage to display is a blank page and the code is still not fired.

我找到了很多如何让 PHP 在 Tomcat 上运行的指南,但都是在以前的版本上。我尝试了所有这些,但我只能设法显示一个空白页面,并且代码仍未被触发。

I understand that Tomcat is build for Java application and not PHP, but I need to find a way to do that with Tomcat 8. Does any of you know a resource that could help me with this? I tried the guides in the following links, but without luck:

我知道 Tomcat 是为 Java 应用程序而不是 PHP 构建的,但我需要找到一种方法来使用 Tomcat 8 来做到这一点。你们中有人知道可以帮助我解决这个问题的资源吗?我尝试了以下链接中的指南,但没有运气:

http://toHymanwu.blogspot.com/2008/10/php-5-on-tomcat-6-installation.html

http://toHymanwu.blogspot.com/2008/10/php-5-on-tomcat-6-installation.html

http://php-java-bridge.sourceforge.net/doc/tomcat6.php

http://php-java-bridge.sourceforge.net/doc/tomcat6.php

Any idea if this is possible with Tomcat 8 and how can I do it?

知道 Tomcat 8 是否可以做到这一点,我该怎么做?

OS: Windows;

操作系统:Windows;

采纳答案by Brian Showalter

Your best bet to run PHP on top of Tomcat is probably to download and install the Quercus WAR file. Quercus is a Java-based implementation of PHP 5, and it can be found at http://quercus.caucho.com/.

在 Tomcat 上运行 PHP 的最佳选择可能是下载并安装 Quercus WAR 文件。Quercus 是基于 Java 的 PHP 5 实现,可以在http://quercus.caucho.com/上找到。

回答by user1135940

Please follow the guide from: http://php-java-bridge.sourceforge.net/pjb/webapp.php

请按照以下指南操作:http: //php-java-bridge.sourceforge.net/pjb/webapp.php

The above has been verified in TomEE, which is based on Tomcat

以上已经在基于Tomcat的TomEE中得到验证

Note that Tomcat 8 still contains a bug. As a workaround you'll need to add an empty "java" directory to the JavaBridgeTemplate.war zip file:

请注意,Tomcat 8 仍然包含一个错误。作为一种解决方法,您需要将一个空的“java”目录添加到 JavaBridgeTemplate.war zip 文件中:

drwxr-xr-x         0  31-Oct-2010  15:24:24  WEB-INF/
-rw-r--r--       239  31-Oct-2010  15:20:30  WEB-INF/weblogic.xml
drwxr-xr-x         0  31-Oct-2010  15:24:24  WEB-INF/lib/
-rw-r--r--    436954  31-Oct-2010  15:24:24  WEB-INF/lib/JavaBridge.jar
-rw-r--r--     58673  31-Oct-2010  15:24:24  WEB-INF/lib/php-script.jar
-rw-r--r--     58252  31-Oct-2010  15:24:24  WEB-INF/lib/php-servlet.jar
-rw-rw-r--      3871  31-Oct-2010  15:24:50  index.php
-rwxrwxr-x        19  31-Oct-2010  15:24:50  test.php
-rw-rw-r--      1779  31-Oct-2010  15:24:50  WEB-INF/web.xml
drwxr-xr-x         0  25-Apr-2016  20:53:10  java/