内容简介:翻译自: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 发布,新增显示运行脚本的功能
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
《电脑报》2005年合订本(上下)
电脑报社主编 / 西南师范大学出版社 / 2006-1 / 45.00元
全套上、下两册,浓缩2005年电脑报精华文章;附录包含70余篇简明IT应用指南,涵盖软件、硬件、数码、网络四大领域,配赠权威实用的2005-2006中国计算机年鉴光盘,近1.4GB海量信息与资源超值奉献,提供2005-2006全系列硬件、数码产品资讯,兼具知识性与资料性,连结购买每年《电脑报合订本》,你将拥有一套完整的实用大型电脑文库。一起来看看 《《电脑报》2005年合订本(上下)》 这本书的介绍吧!