gpt4 book ai didi

php - 无法在Tomcat下运行PHP脚本

转载 作者:可可西里 更新时间:2023-11-01 12:38:57 24 4
gpt4 key购买 nike

我正在使用 Tomcat 6。我已经安装了 PHP,并尝试使用 PHP/JavaBridge 使 PHP 在 Tomcat 中运行。我已经在 Tomcat 的 webapps 目录中部署了 JavaBridge.war。运行任何 PHP 脚本时,我都会在下面收到此错误。请帮忙,我感谢你的帮助。

这是我配置 PHP 的方式:

./configure --with-mime-magic --with-config-file-path=/usr/local/Zend/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr --with-mhash=/usr/local --with-bz2=/usr --with-curl=/usr --with-gettext=/usr --with-mysql=/usr/local/mysql --with-mcrypt=/usr/local --enable-magic-quotes --enable-bcmath --enable-calendar --enable-ftp --enable-sockets --enable-wddx --enable-mbstring --enable-zip --enable-exif --with-gd=/usr --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --enable-fastcgi --enable-force-cgi-redirect

Tomcat报错信息如下:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: php.java.bridge.http.FCGIConnectException: Could not connect to server php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:133) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579) org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584) java.lang.Thread.run(Thread.java:662) root cause

php.java.bridge.http.FCGIConnectException: Could not connect to server php.java.bridge.http.SocketChannelFactory.test(SocketChannelFactory.java:58) php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:131) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579) org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584) java.lang.Thread.run(Thread.java:662) root cause

java.io.IOException: java.net.ConnectException: Connection refused php.java.bridge.http.FCGIConnectException.(FCGIConnectException.java:37) php.java.bridge.http.SocketChannelFactory.test(SocketChannelFactory.java:58) php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:131) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579) org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584) java.lang.Thread.run(Thread.java:662) root cause

java.io.IOException: PHP not found. Please install php-cgi. PHP test command was: [php-cgi, -v] php.java.bridge.Util$Process.start(Util.java:1145) php.java.servlet.fastcgi.FCGIProcess.start(FCGIProcess.java:68) php.java.bridge.http.SocketChannelFactory.doBind(SocketChannelFactory.java:125) php.java.bridge.http.FCGIConnectionFactory.runFcgi(FCGIConnectionFactory.java:88) php.java.bridge.http.FCGIConnectionFactory$1.run(FCGIConnectionFactory.java:109) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.

Apache Tomcat/6.0.29

最佳答案

我和你的错误一样,您在这里缺少的关键点是:

PHP CLI(命令行界面)需要设置才能与 java-php 一起工作 桥梁

因为你声称已经安装了 PHP(任何意味着 XAMPP/WAMP)

完成以下步骤:

  • 将 PHP 添加到 PATH 环境变量 - Help
  • 运行CMD确认配置>

    php-cgi -v
  • 通过上面的命令你会看到PHP版本信息
  • 重启Tomcat

PHP/JavaBridge 应该在此之后开始工作。

关于php - 无法在Tomcat下运行PHP脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7121372/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com