The soluble PHPJavaBridge server fork allows PHP/JVM interoperability through a local network protocol between both runtimes.
Disclaimer: Unofficial fork !!!
This fork was initially made on the sourceforge version made by Jost Boekemeier as its development seemed to have stopped after version 6.2.1.
Be aware that since the project have been forked, the official repo looks to be alive again with recent versions supporting PHP7. Unfortunately most of the the fixes and enhancements made on this fork have not been merged in upstream version.
Feel free to choose which version you install (fork or official). To keep a track of differences, you can refer to the fork status page.
Note that this fork have been specifically designed for PHP -> Java integration, so so if you intend to use it from Java -> PHP, the best is to use the official version as it looks better tested for that scenario.
This repository can be used to develop, test and and build the JavaBridge server.
Be sure to consult the soluble-japha website where you'll find more information relative to php/java integration.
- Soluble PHPJavaBridge server API doc.
- PHP
soluble-japha
client documentation
Older documentation can be found in the PHP/Java bridge site
-
You can download pre-compiled java bridge binaries on the releases page (jdk8).
-
Major releases are published on Maven central.
With maven:
<dependency> <groupId>io.soluble.pjb</groupId> <artifactId>php-java-bridge</artifactId> <version>x.y.z</version> </dependency>
or gradle
compile 'io.soluble.pjb:php-java-bridge:x.y.z'
To register the PHPJavaServlet, you can have a look to the example web.xml file.
- Oracle JDK 7,8
- Optionally
ant
for old Java.inc generation
You can either clone the project with:
$ git clone https://github.com/belgattitude/php-java-bridge.git
or download a zip tarball from the github page.
Build the project with the provided gradle wrapper:
$ cd php-java-bridge
$ ./gradlew build
The generated files are available in the /build/libs
folder:
File | Description |
---|---|
php-java-bridge-<VERSION>.jar |
JavaBridge library (servlet and standalone). |
php-java-bridge-<VERSION>-sources.jar |
Source code. |
php-java-bridge-<VERSION>-javadoc.jar |
Generated api doc. |
Additionally a generic template file is automatically generated:
File | Description |
---|---|
JavaBridgeTemplate.war |
A ready to deploy war example file. |
Instead of modifying directly the main build.gradle
file, you should consider using
init-scripts. Examples can be found on the init-scripts doc.
Currently only tested on Tomcat 7/8, should be running on any servlet 2.5 compatible container.
You can have a look to the web.xml default configuration for the servlet configuration settings.
Ensure you have a Tomcat server installed.
And copy the ready to run JavaBridgeTemplate.war
in the tomcat webapps folder:
$ sudo cp ./build/libs/JavaBridgeTemplate.war /var/lib/tomcat8/webapps/JavaBridgeTemplate.war
Wait few seconds for deployment and point your browser to http://localhost:8080/JavaBridgeTemplate, you should see the bridge landing page :
Have a look to the error log if needed:
$ cat /var/log/tomcat8/catalina.out
For development, the use of the ./gradlew tomcatRun
and ./gradlew tomcatStop
allows testing
without the need of deployment.
Dependencies can be added in the build.gradle
file.
If you get OutOfMemory errors, you can increase the java heap tomcat:
$ sudo vi /etc/default/tomcat8
Look for the Xmx default at 128m and increase
JAVA_OPTS="-Djava.awt.headless=true -Xmx512m -XX:+UseConcMarkSweepGC"
and restart
$ sudo service tomcat8 restart
Feel free to fork and submit pull requests :)
Original developers:
- Jost Boekemeier
- Andre Felipe Machado,
- Sam Ruby,
- Kai Londenberg,
- Nandika Jayawardana,
- Sanka Samaranayake,
Forked version
- Christian P. Lerch: Java refactorings and modernizations.
- SĂ©bastien Vanvelthem: Fork initiator and maintainer.
See the CREDITS.md for an up to date of list of contributors.