Tomcat configuration PHP cannot use $_post, $_get

Source: Internet
Author: User
Tags configuration php
in charge of a Web site that uses JSP Dynamic Web technology, just have a part of PHP writing function, so it is very straightforward to think that Tomcat support PHP. Tomcat is also Apache out, is it only support JSP? Is it possible to use PHP on tomcat? Search the Internet and soon have the answer to the first question: Tomcat can support CGI, such as Perl (see enclosure for specific settings). But continue to search, but have been unable to find a way for Tomcat to use PHP, is generally taken to install Apache and Tomcat coexistence method to build so-called support php+jspWeb Platform .

Windows operating system web.xml

<init-param><param-name>executable</param-name><param-value>php</param-value> </init-param>


and add the PHP installation path to path so that Tomcat can run toit's PHP.exe. After rebooting Tomcat, theWeb-infdirectory to create a new CGI directory, put the PHP file here, and then access the virtual map outCgi-bin Directoryto access these PHP files.
But if you don't make any changes to your PHP files, you may find that you don't have any output. Need to add a line to the header of the PHP file, output two carriage returns:
echo "\ n";
The reason is not very clear. May be waiting for content-type input, or Perl's CGI program style.
However, with this configuration, PHP (4.1.0 or later) $_request, $_get, $_posTSuch variables cannot be used, only querystring are obtained from the server variables or environment variables: $_server["query_string", "$_env[" query_string "]. The post submission of the form may not be supported ... I haven't tried it yet..
because of the Tomcat is not familiar with, so these are only in the current method of small repair, may have good practices, but also hope that everyone feel free!

Related recommendations:

How to install Tomcat7.0.82 under Linux

Introduction to several kinds of loaders in Tomcat

The overall structure of TOMCAT is detailed

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.