javaphptomcatxamppphp-java-bridge

PHP - Error installing JavaBridge.war


I'm trying to install JavaBridge as I want to make connections between my php files and Java files. I need my php request a GET method to Java file, and Java file will get the ID and run some script and return with an ARRAY.

I tried to install JavaBridge, but I get errors while trying to excess to localhost:8080/JavaBridge

javax.servlet.ServletException: php.java.bridge.http.FCGIConnectException: Could not connect to     server

php.java.bridge.http.FCGIConnectException: Could not connect to server

java.io.IOException: File \\.\pipe\C:\apache-tomcat-7.0.39\temp\JavaBridge939398813756155712.socket not writable

java.io.IOException: PHP not found. Please install php-cgi. PHP test command was: [php-cgi, -v] 

I didn't show out all the errors here, I showed only the first line of each root cause.

I will give more details in my setup. I'm using XAMPP all the time, with PHP, MySQL in the XAMPP.

Then I just installed Tomcat inorder to install JavaBridge. I copied JavaBridge.war into c:/tomcats/webapps, copied JavaBridge.jar and php-servlet.jar into c:/tomcats/lib

I assume the problems should lies with the PHP, but I don't know how to fix it as well. Install PHP again? but I'm not sure too.

Whats the problem with my setup?

Or is there others way to make connections between PHP and Java as what I stated above?

Thank you.


Solution

  • Have you enabled php-cgi?

    Here's how u can do it. Go to: xampp\apache\conf\extra\httpd-xampp.conf and uncomment this:

    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php-cgi
    </FilesMatch>
    <IfModule actions_module>
        Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
    </IfModule>
    

    Restart Apache & Tomcat.