Resolve "PHP not found" of PHP/Java Bridge on Gentoo Linux

Environment:
  • Gentoo Linux
  • dev-lang/php-5.3.8 +cgi
  • www-apache/mod_fastcgi-2.4.7_pre0910052141
  • www-servers/tomcat-6.0.32-r1

PHP/Java Bridge: 6.2.1, installed in /var/lib/tomcat-6/webapps/JavaBridge

Problem Description:
Follow the installation guide on the PHP/Java Bridge website.  The test by the following command does not report any error.
java -classpath JavaBridge.war TestInstallation
However, when visiting the URL http://localhost:8080/JavaBridge, an error message is returned:
java.io.IOException: PHP not found. Please install php-cgi.
PHP test command was: [/usr/bin/php-cgi, -v]

Resolution:
  1. Edit /var/lib/tomcat-6/webapps/JavaBridge/WEB-INF/web.xml.  Uncomment the following line:
    <context-param><param-name>php_exec</param-name><param-value>php-cgi</param-value></context-param>
  2. Rename the pre-compiled php-cgi brought by JavaBridge.war.
    $ cd /var/lib/tomcat-6/webapps/JavaBridge/WEB_INF/cgi/i386-linux
    $ mv php.cgi php.cgi.pjb
  3. Create a symbolic link to /usr/bin/php-cgi. Assume the working directory is /var/lib/tomcat-6/webapps/JavaBridge/WEB_INF/cgi/i386-linux.
    $ ln -s /usr/bin/php-cgi .

It is also working to use the pre-compiled php-cgi from PHP/Java Bridge. Instead of steps 2 and 3, simply make the php-cgi executable.
$ chmod +x /var/lib/tomcat-6/webapps/JavaBridge/WEB_INF/cgi/i386-linux/php-cgi
Note that the pre-compiled php-cgi from PHP/Java Bridge is not recommended.

0 意見: