Here are steps to install and run php in tomcat server.
- Download and install latest java from Oracle http://www.oracle.com/technetwork/java/javase/downloads/index.html
- Set java_home in system classpath
- Download latest tomcat from “http://tomcat.apache.org/download-70.cgi” and unzip c:\tomcat
- Download latest php for window “http://windows.php.net/download/”and unzip to a directory,
c:\php
- Set path in you system for php folder like
path=%path%;c:\php
- Download latest PECL Win32 binaries from http://museum.php.net/php5/ like download “pecl-5.2.5-Win32.zip”
- Download latest PHP-JAVA Bridge war file from http://sourceforge.net/projects/php-java-bridge/files/Binary%20package/php-java-bridge_6.2.1/
- Go to you php installation folder c:\php and rename “php.ini-production” file to “php.ini” file
- Add the new line (If does not exist) in new php.ini:
;extension=php_java.dll
- Copy php5servlet.dll from PECL 5.2.5 to c:\php
- copy php_java.dll from PECL 5.2.5 to
c:\php\ext
- Copy downloaded ” JavaBridgeTemplate621.war” to tomcat\webapps folder and rename as php.war
- Now start tomcat and access you php-java bridge application and test your php file “http://localhost:8080/php/”
- If you are creating any php file it should go in tomcat\webapps\php\ folder
If you are getting Error “Could not start FCGI server: java.io.IOException: PHP not found. Please install php-cgi” then MSVCR110.dll is missing from your system. Please install Visual C++ library from Microsoft website “http://www.microsoft.com/en-us/download/confirmation.aspx?id=30679”. Make sure you download and install the x86 version not 64bit version
Rajnish Kumar is CTO of Vanrish Technology with Over 25 years experience in different industries and technology. He is very passionate about innovation and latest technology like APIs, IOT (Internet Of Things), Artificial Intelligence (AI) ecosystem and Cybersecurity. He present his idea in different platforms and help customer to their digital transformation journey.