Home >Backend Development >PHP Problem >How to deploy php project in tomcat

How to deploy php project in tomcat

藏色散人
藏色散人Original
2020-11-20 09:25:543608browse

How to deploy the php project in tomcat: first download the relevant jar package; then modify the web.xml file in the conf folder in the tomcat installation directory; then copy the php project to tomcat's webapps directory; finally start Just use tomcat.

How to deploy php project in tomcat

Recommended: "PHP Video Tutorial"

1. Download related jar packages

Copy JavaBridge.jar, php-servlet.jar and php-script.jar in phpJavaBridge.rar to tomcat’s lib directory;

2.Modify tomcat In the web.xml file in the conf folder under the installation directory, add the following code in the web-app tag

<listener>
<listener-class>php.java.servlet.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>PhpJavaServlet</servlet-name>
<servlet-class>php.java.servlet.PhpJavaServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>PhpCGIServlet</servlet-name>
<servlet-class>php.java.servlet.fastcgi.FastCGIServlet</servlet-class>
<init-param>
<param-name>prefer_system_php_exec</param-name>
<param-value>On</param-value>
</init-param>
<init-param>
<param-name>php_include_java</param-name>
<param-value>Off</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>PhpJavaServlet</servlet-name>
<url-pattern>*.phpjavabridge</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>PhpCGIServlet</servlet-name>
<url-pattern>*.php</url-pattern>
</servlet-mapping>

3. Deploy the php project

Copy the php project directly to the webapps directory of tomcat, and then start tomcat.

The above is the detailed content of How to deploy php project in tomcat. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn