使用Tomcat运行PHP应用程序? [英] Run a php app using tomcat?

查看:226
本文介绍了使用Tomcat运行PHP应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能使用Tomcat运行PHP应用程序?在你告诉我只是使用的httpd,我已经在自己的主机在/ MyApp的Web服务器上运行的Java应用程序。现在,我想在主机/ roundcube安装RoundCube。一个是PHP然而,一个就是Java。我不断看到随便引用说这是可能的,但没有真正的指令。不,我不想把它们放在单独的端口,我需要标准的HTTP和HTTPS端口。没有人有任何资源吗?

Is it possible to run a php app using tomcat? Before you tell me to just use httpd, I already have a java application running on my webserver at host/myapp. Now I want to install RoundCube at host/roundcube. One is php however and one is java. I keep seeing offhand references saying this is possible but no real instructions. No, I do not want to put them on separate ports, I need the standard http and https ports. Does anyone have any resources for this?

推荐答案

是的,它是可能的将书斋。我们可以使用它自己的端口号本地主机运行Tomcat服务器PHP code:8080

Yes it is Possible Will Den. we can run PHP code in tomcat server using it's own port number localhost:8080

我在这里写一些步骤,就是这么多对你有用。

here I'm writing some step which is so much useful for you.

如何安装或在Tomcat 6在Windows上运行PHP


  1. 下载并解压PHP 5到一个目录, C:\\ PHP-5.2.6-Win32的 - php-5.2.9-2-Win32.zip~~MD~~aux下载

下载 PECL 5.2.5的Win32 的二进制文件 - PECL 5.2.5 Win32的下载

download PECL 5.2.5 Win32 binaries - PECL 5.2.5 Win32 Download

改名的php.ini-dist的的php.ini Ç :\\ PHP-5.2.6-Win32的

取消注释或的php.ini 添加行(删除开头分号):
;延长= php_java.dll

Uncomment or add the line (remove semi-colon at the beginning) in php.ini: ;extension=php_java.dll

复制 php5servlet.dll 从PECL 5.2.5到 C:\\ PHP-5.2.6-Win32的

copy php5servlet.dll from PECL 5.2.5 to c:\php-5.2.6-Win32

复制 php_java.dll PECL 5.2.5 C:\\ PHP-5.2.6 -Win32 \\分机

复制 php_java.jar PECL 5.2.5 的tomcat \\ lib中

创建一个名为的tomcat \\的webapps PHP(或什么都ü喜欢)目录

create a directory named "php" (or what ever u like) in tomcat\webapps directory

复制 phpsrvlt.jar PECL 5.2.5 的tomcat \\的webapps \\ PHP \\ WEB- INF \\ lib中

不能解压缩或解压缩 phpsrvlt.jar 用于解压缩用winrar或WinZip的为不能解压缩使用:罐子XFV phpsrvlt.jar

Unjar or unzip phpsrvlt.jar for unzip use winrar or winzip for unjar use : jar xfv phpsrvlt.jar

同时更改网​​\\ PHP \\ reflect.properties 网​​\\ PHP \\ servlet.properties 库= php5servlet

重新创建jar文件
- >罐子CVF php5srvlt.jar网/ PHP /的
PS:如果你有jar文件犯规运行的路径添加到系统变量对我来说,我添加 C:\\ Program Files文件\\的Java \\ jdk1.6.0 \\ BIN;为系统变量/路径

Recreate the jar file -> jar cvf php5srvlt.jar net/php/. PS: if the jar file doesnt run you have to add the Path to system variables for me I added C:\Program Files\Java\jdk1.6.0\bin; to System variables/Path

创建的web.xml 的tomcat \\的webapps \\ PHP \\ WEB-INF 与此内容:

<web-app version="2.4" 
  xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
  http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
  <servlet>
    <servlet-name>php</servlet-name>
    <servlet-class>net.php.servlet</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>php-formatter</servlet-name>
    <servlet-class>net.php.formatter</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>php</servlet-name>
    <url-pattern>*.php</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>php-formatter</servlet-name>
    <url-pattern>*.phps</url-pattern>
  </servlet-mapping>
</web-app>


  • 添加PHP路径( C:\\ PHP-5.2.6-Win32的),以您在Windows enironment系统或用户路径(提示:右键单击并从选择属性我的电脑

  • Add PHP path( c:\php-5.2.6-Win32) to your System or User Path in Windows enironment (Hint: Right-click and select Properties from My Computer

    创建 test.php的根据的tomcat \\测试的webapps \\ PHP

    重新启动Tomcat

    Restart tomcat

    浏览本地主机:8080 / PHP / test.php的

    这篇关于使用Tomcat运行PHP应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆