Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build tomcat php environment

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to build the tomcat php environment, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

The method to build the tomcat php environment: 1, copy the downloaded php to the corresponding directory; 2, extract and rename it to "php"; 3, modify content.xml;4, modify the web.xml under the conf folder in tomcat.

This article operating environment: Windows7 system, PHP7.1 version, Dell G3 computer.

Php+tomcat configure the runtime environment

Screenshot of completion!

Although you can run a php project in tomcat, it doesn't mean you don't have to configure the php environment, so the first step is to install the php environment. At present, it is common to use apache+php+mysql to form the development of a php project, which can be installed separately. But the author is lazy and not interested in studying php in depth, so I use xampp, which can install all the environments needed for PHP development, including compilers, at one time.

Copy the downloaded php to this directory, then extract it and rename it to "php". If you do not download php, please xampp the download address:

Https://www.apachefriends.org/zh_cn/index.html

Just choose the download version according to our environment:

Install it after downloading, as long as you keep going to the next step. But one of the more important steps is to choose the content of the environment to install. The following figure:

Two of the undeliverable ticks are necessary, and that php is the Php development environment we want. The rest are not installed because the author's computer itself is equipped with mysql and tomcat. The reader chooses to install according to his own situation.

Extension_dir = "ext" cgi.force_redirect = 0

3. Modify content.xml

Or just copy the following code into it.

Content.xml of conf in Tomcat

WEB-INF/web.xml WEB-INF/tomcat-web.xml ${catalina.base} / conf/web.xml

4. Modify web.xml. Modify the web.xml under the conf folder in tomcat.

Copy the following code to web.xml. Create a servlet (the xml format can be changed, it is recommended that you format xml to correct errors caused by blog writing and replication)

Just copy it to the first default servlet

Php org.apache.catalina.servlets.CGIServlet clientInputTimeout 200 debug 0 executable F:\ tomcat\ php\ php-cgi.exe passShellEnvironment true cgiPathPrefix WEB-INF/phpbin 5 php / phpbin/*

5. Create a new folder phpbin, and then put the php file in it

The test files are:

Index.php

The code is as follows (just copy with copy)

The test address is:

Local address

Thank you for reading this article carefully. I hope the article "how to build a tomcat php Environment" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report