Reputation: 13125
i want to run single php file using apache-tomcat-6.0.18
my project is GWT project with server side is java servlet
i deployed my project on server in apache-tomcat-6.0.18/webapps/ folder
So please tell me the solution to run php file
Upvotes: 0
Views: 16733
Reputation: 121
Quercus has a war that allows to run PHP scripts in apache tomcat or glassfish. For a step by step guide look at this article
Upvotes: 0
Reputation: 21
"www" folder is present in IIS server not in apache ... In apache tomcat server instead of "www" , "Root" folder is present copy all those needed files in that root folder and have acces to thos files
after installation of any server a single restart is mandatory ,, otherwise results are unpredictable... Thanks a lot
Upvotes: 2
Reputation: 21
We can do this by using JavaBridge..
Download below jar file (ie extract jars from JavaBridge.war)
JavaBridge.jar
php-script.jar
php-servlet.jar
and put into your project lib folder. then type the following entry in web.xml
web.xml
<!-- the following 8 lines extend the servlet spec 2.2 "url-pattern" to handle PHP PATH_INFO: *.php/something?what=that. Remove them, if you don't need this feature. -->
<filter>
<filter-name>PhpCGIFilter</filter-name>
<filter-class>php.java.servlet.PhpCGIFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PhpCGIFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- the following adds the JSR223 listener. Remove it if you don't want to use the JSR223 API -->
<listener>
<listener-class>php.java.servlet.ContextLoaderListener</listener-class>
</listener>
<!-- the back end for external (console, Apache/IIS-) PHP scripts; remove it if you don't need this -->
<servlet>
<servlet-name>PhpJavaServlet</servlet-name>
<servlet-class>php.java.servlet.PhpJavaServlet</servlet-class>
</servlet>
<!-- runs PHP scripts in this web app; remove it if you don't need this -->
<servlet>
<servlet-name>PhpCGIServlet</servlet-name>
<servlet-class>php.java.servlet.fastcgi.FastCGIServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</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>
save the file. Restart tomcat server. now Php files will be work under tomcat server!
Upvotes: 2
Reputation: 73
Use the PHP/Java Bridge. As long as your PHP was compiled with cgi support, it should work seamlessly.
Upvotes: 1
Reputation: 382806
You should put your php file in www
folder in apache installation and then you can access that file from browser like this:
http://localhost/your_file_name.php
localhost
is the default host name in most configurations.
Upvotes: -1