Home > Backend Development > PHP Problem > Can php use tomcat?

Can php use tomcat?

藏色散人
Release: 2023-02-26 12:20:01
Original
3999 people have browsed it

Can php use tomcat?

Can php use tomcat?

php can run on tomcat, but it requires a little configuration

Extract php to the root directory of tomcat and change the folder name to php

Add the path where php.exe is located to path.

● Make a copy of php.ini-development. Rename php.ini

Open extension_dir = "ext" option

● Modify cgi.force_redirect to cgi.force_redirect = 0

● Modify tomcat/conf/context. xml file

● Add the privileged="true" attribute to , that is:

● In Join

<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>D:\tomcat\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/phpbin</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet> <servlet-mapping>
<servlet-name>php</servlet-name>
<url-pattern>/phpbin/*</url-pattern>
</servlet-mapping>
Copy after login

Restart tomcat service:

Create a new phpbin folder under webapps\ROOT\WEB-INF

Create a new index.php below

<?php phpinfo();
Copy after login

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of Can php use tomcat?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template