内容简介:翻译自:https://stackoverflow.com/questions/7121372/cannot-run-php-script-under-tomcat
/ JavaBridge在Tomcat中运行PHP.我在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应该在此之后开始工作.
翻译自:https://stackoverflow.com/questions/7121372/cannot-run-php-script-under-tomcat
以上所述就是小编给大家介绍的《无法在Tomcat下运行PHP脚本》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 如何从PHP脚本(如批处理文件)中运行多个PHP脚本?
- 如何安全地运行用户的 JavaScript 脚本
- 使用Ant在后台运行PHP脚本
- 以管理员身份运行BAT脚本
- windows定时自动运行R脚本的正确姿势
- RubyMine 2018.2.3 发布,新增显示运行脚本的功能
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
程序员面试宝典(第5版)
欧立奇、刘洋、段韬 / 电子工业出版社 / 2015-10 / 55.00
容提要 《程序员面试宝典(第5版)》是《程序员面试宝典》的第5 版,在保留第4 版的数据结构、面向对象、程序设计等主干的基础上,修正了前4 版近40 处错误,解释清楚一些读者提出的问题,并使用各大IT 公司及相关企业最新面试题(2014-2015)替换和补充原内容,以反映自第4 版以来两年多的时间内所发生的变化。 《程序员面试宝典(第5版)》取材于各大公司面试真题(笔试、口试、电话面试......一起来看看 《程序员面试宝典(第5版)》 这本书的介绍吧!