My quest is to run UCanAccess
on top of the bridge, trying to execute SQL-queries on Microsoft Access databases on Linux from PHP. Being a new user, I spent quite some time figuring out how to get it running on my Debian Linux server as a webapp for Tomcat. Just some moments ago I succeeded, still I think the process can be made much easier. Therefore I will try to illustrate the steps I took and what went wrong initially:
Step 1: I read the text on top of this page: http://php-java-bridge.sourceforge.net/pjb/installation.php
- Requirement 1: Java 1.4 or above: solved by doing: `sudo apt-get install openjdk-7-jdk`
- Requirement 2: a standard JEE server: solved by doing: `sudo apt-get install tomcat8`and adding the following to /etc/tomcat8/tomcat-users.xml: <role rolename="manager-gui"/><role rolename="admin-gui"/><user username="tomcat" password="********" roles="manager-gui,admin-gui"/>
- Requirement 3: do not search for a PHP extension: satisfied.
- Step 2: I downloaded the documentation using the link on top of this page: http://php-java-bridge.sourceforge.net/pjb/examples.php
- Step 3: I extracted JavaBridge.war from the documentation archive php-java-bridge_6.2.1_documentation.zip.Step 4: I tested the PHP installation using `java -classpath JavaBridge.war TestInstallation`.
- Fail 1: testing failed because of the executable file "php-cgi" missing, despite requirement "3", I had to do `sudo apt-get install php5-cgi`.
- Step 5: I watched the animated gif movie mentioned on the bottom of the installation page: http://php-java-bridge.sourceforge.net/pjb/user-contributed/JavaEchoServer.gif
- Step 6: as seen in the movie, I copied JavaBridge.war to the webapps folder (also tried with JavaBridgeTemplate.war), by doing `sudo cp ~/JavaBridge.war /var/lib/tomcat8/webapps`.Step 7: I verified in the Tomcat-manager that the webapp actually got deployed: `lynx http://localhost:8888/manager`
Step 8: I extracted php-java-bridge_6.2.1_documentation.zip/documentation/src.zip/java/* to /var/lib/tomcat8/webapps/JavaBridge/*.
- Fail 2: the webapp Javabridge failed to start, to find out why I did `sudo vi /var/lib/tomcat8/logs/localhost.2015-06-20.log.` This showed that the 'java' folder (or 'Java.inc') was somehow required and could somehow not be found, preventing the webapp to start.
- Success: the webapp started and this call worked, providing access to all the nice example PHP-scripts: `lynx http://localhost:8888/JavaBridge`
So my hope is that the documentation can be improved upon a bit, and that the 'java' folder (or just the 'java/Java.inc' file) can be integrated into both JavaBridge.war and JavaBridgeTemplate621.war (after all the template is the one shown in the animated gif demonstration). It would be nice if this could be done, because I almost gave up upon this great tool because of these issues and I've seen in the mailing list archive that other people wrestle with such issues as well. After all Tomcat is one of the recommended and supported choices for JavaBridge.
PHP/Java Bridge, along with Tomcat, is a great solution for integrating Java source code with PHP. Unfortunately its installation procedure was not well documented.