标签: php-java-bridge

通过PHP使用Eclipse BIRT Report Designer

我想在php webproject中使用Birt Reports.因此,我通过将JavaBridgeTemplate621.war和birt.war移动到我的Tomcat来安装推荐的Java Bridge和BIRT Runtime.

之后我写了一个叫BirtEngine的短课:

try {
    $ctx = java_context()->getServletContext();
    $this->birdEngine = java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx);
    java_context()->onShutdown(
        java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook()
    );
} catch (java_InternalException $e) {
    die($e->getMessage());
}
Run Code Online (Sandbox Code Playgroud)

当我认识到$e->getMessage()返回时""我会看一下catalina.out并且在那里我发现了这个异常:

23.03.2011 15:02:43 org.apache.cxf.interceptor.AttachmentInInterceptor handleMessage
INFO: AttachmentInInterceptor skipped in HTTP GET method
23.03.2011 15:02:43 org.apache.cxf.interceptor.StaxInInterceptor handleMessage
INFO: StaxInInterceptor skipped.
23.03.2011 15:02:43 org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor handleMessage
INFO: ReadHeadersInterceptor skipped in HTTP GET method
23.03.2011 15:02:43 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No such operation:
        at org.apache.cxf.interceptor.URIMappingInterceptor.handleMessage(URIMappingInterceptor.java:77)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
        at …
Run Code Online (Sandbox Code Playgroud)

php birt classnotfoundexception php-java-bridge

8
推荐指数
1
解决办法
2086
查看次数

无法在Tomcat下运行PHP脚本

我正在使用Tomcat 6.我已经安装了PHP并尝试使用PHP/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状态500 -

类型异常报告

信息

description服务器遇到内部错误(),导致无法完成此请求.

例外

javax.servlet.ServletException:php.java.bridge.http.FCGIConnectException:无法连接到服务器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原因

php.java.bridge.http.FCGIConnectException:无法连接到服务器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)根本原因

java.io.IOException:java.net.ConnectException:连接被拒绝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)根本原因

java.io.IOException:找不到PHP.请安装php-cgi.PHP测试命令是:[php-cgi,-v] php.java.bridge.Util $ Process.start(Util.java:1145)php.java.servlet.fastcgi.FCGIProcess.start(FCGIProcess.java:68)php …

php tomcat php-java-bridge

8
推荐指数
1
解决办法
1万
查看次数

使用PHP将二进制流写入浏览器

背景

尝试将使用iReport通过PHP编写的PDF报告流式传输到浏览器.一般的问题是:如何使用PHP将二进制数据写入浏览器?

工作守则

header('Cache-Control: no-cache private');
header('Content-Description: File Transfer');
header('Content-Disposition: attachment, filename=climate-report.pdf');
header('Content-Type: application/pdf');
header('Content-Transfer-Encoding: binary');

$path = realpath( "." ) . "/output.pdf";

$em = java('net.sf.jasperreports.engine.JasperExportManager');
$result = $em->exportReportToPdf($pm);
header('Content-Length: ' . strlen( $result ) );

$fh = fopen( $path, 'w' );
fwrite( $fh, $result );
fclose( $fh );

readfile( $path );
Run Code Online (Sandbox Code Playgroud)

非工作准则

header('Cache-Control: no-cache private');
header('Content-Description: File Transfer');
header('Content-Disposition: attachment, filename=climate-report.pdf');
header('Content-Type: application/pdf');
header('Content-Transfer-Encoding: binary');

$path = realpath( "." ) . "/output.pdf";

$em = java('net.sf.jasperreports.engine.JasperExportManager');
$result = $em->exportReportToPdf($pm);
header('Content-Length: …
Run Code Online (Sandbox Code Playgroud)

php java fopen jasper-reports php-java-bridge

6
推荐指数
1
解决办法
4353
查看次数

xampp,php-java-bridge show通知:未定义的属性:java_Client :: $ cancelProxyCreationTag

当我尝试使用javaBridge时,我得到以下通知,因为我想在php中使用java代码,我遵循了一些教程但是遵循了以下内容

Undefined property: java_Client::$cancelProxyCreationTag in D:\xampp\htdocs\java\Java.inc on line 1994
Run Code Online (Sandbox Code Playgroud)

整个test.php文件如下,除了通知其他东西是正常的,

php-java-bridge config...

Java version=1.7.0_55 

Notice: Undefined property: java_Client::$cancelProxyCreationTag in D:\xampp\htdocs\java\Java.inc on line 1994
Java vendor=Oracle Corporation 
OS=Windows 7 6.1 on amd64 
???, ?? 27, 2014 at 4:56:58 ?? ??????
Run Code Online (Sandbox Code Playgroud)

有人遇到同样的麻烦吗?谢谢!

php java xampp php-java-bridge

6
推荐指数
1
解决办法
1732
查看次数

如何在不为Java Bridge添加tomcat服务器的情况下将Java后端添加到现有PHP站点?

目前我们正在为我们的网站使用PHP.现在我们考虑用Java编写后端,因为语言的类型安全性以及Java的各种工具的可用性.我一直在阅读有关Java Bridge的内容,现在我想知道如何设置它.

我们已经通过Apache使用PHP了.我读到要使用Java Bridge我也需要安装Tomcat.这意味着我有两个服务器(Apache和Tomcat),我需要为后端增加安全性,因为它突然对整个世界开放......我错过了什么?是否有另一种方法可以在没有额外服务器的情况下建立PHP-Java连接?这通常是怎么做的?

关于如何执行此操作的任何指示或链接或有关如何设置它的任何最佳实践,我们非常感谢.我没有找到官方的Java Bridge网站.谢谢!

php tomcat php-java-bridge

5
推荐指数
1
解决办法
1983
查看次数

使用Php-Java Bridge

我无法Php-Java Bridge正确设置设置.

我会解释我做了什么.

  • 我的网站是纯PHP的
  • 对于我们的支付交易流程,我们需要设置一个php-java桥
  • 我按照这个链接来设置桥接PHP-JAVA BRIDGE INSTALATION.
  • 在这里,我了解到我需要一个私有的jvm来安装这个桥.
  • 所以,我使用我的c-panel在Private JVM中安装了apache-tomcat-6.0.14.安装后,它要求我将域映射到私有JVM.所以我将我的域example.com(这是唯一可用的选项)映射到它.
  • 然后它要求启用从Apache Web服务器到我的Java应用程序服务器的流量重定向(有一个复选框,我点击它)
  • 最后,它要求我部署WAR文件(JavaBridge.WAR是我的文件),并且everthing似乎很好
  • 现在,当我访问http://example.com/JavaBridge/时,我可以看到javabridge示例,它运行正常.

到现在为止还挺好

现在我的问题从这里开始,当我尝试从php访问java类文件.test.php我创建了一个示例并将以下代码放入其中.

  <?php
        require_once("http://example.com:portnumber/JavaBridge/java/Java.inc");
        $System = java("java.lang.System");
        echo $System->getProperties(); //This Part echo's correctly and shows the data so it means i can access Java.inc Correctly

        $path_e24class = getcwd(). '/e24PaymentPipe.class'; //This part fails both test.php and java class file e24PaymentPipe.class are in the same directory in publich_html folder
        java_require($path_e24class);
        $pipe = new Java("e24PaymentPipe");
        $pipe->setAction("1");
?>
Run Code Online (Sandbox Code Playgroud)

我的站点内容位于public_html文件夹中,WAR文件部署在私有jvm中.

这些是我得到的错误消息.

  1) Warning: …
Run Code Online (Sandbox Code Playgroud)

php java php-java-bridge

5
推荐指数
1
解决办法
2万
查看次数

C++和PHP之间的通用桥梁

我们有一个Web应用程序(相当重的一个),它可以完成一大堆东西,web ui,数学处理和建模,以及与数据库相关的东西.

PHP中发生的许多过程都很慢,主要是因为PHP很难进行数学处理.

在未来,我们希望打破这些缓慢的过程,并以更快的速度重写它们,可能是C++,或者Java.

有没有人知道将数据输入和输出PHP以及进入另一种语言环境的通用方法?我已经考虑将事物序列化为JSON并将它们铲入/ dev/shm或socket,然后让另一种语言侦听套接字,或查看共享内存位置等.

这种类型的东西适用于本机类型,但是当你考虑到传递的很多东西实际上是类实例和类似的对象时,它确实很难用.

我不确定一个合理的解决方案,但我一直在考虑Quercus PHP实现,它是纯Java,以及PHP/Java桥.
但是,我一直无法找到可以执行类似功能的C++.编写PHP模块是可能的,但我很难看到它是如何足够通用的,而不仅仅是将每个新的(和一些旧的)脚本重写到模块中,然后在PHP中调用这些函数.

php c++ java php-java-bridge

5
推荐指数
1
解决办法
1014
查看次数

使用PHP exec()加速后端的可行性

我从PHP的exec()性能中了解到,运行exec()会产生开销,但是在大型程序或网站中,使用另一种语言编写后端的部分并让PHP使用exec调用程序是不是有益处?

例如,我用大量的字符串操作编写/运行了一个测试 - PHP占用了2.3秒而Java占用了.52而C++占用了.33.速度差异已经很明显了.如果我多线程操作,时间可能会加快.我还发现可以通过类似的方式实现并行性

exec("./largeoperation > mydir/$dirname.data &"); 
//or
exec('java Backend > /dev/null 2>&1 &');
Run Code Online (Sandbox Code Playgroud)

除了需要用另一种语言编写代码之外,除了需要用另一种语言编写代码之外,我还没有明白为什么我不应该将后端的更多部分转移到用不同语言编写的更快的程序中.此外,我知道像使用Php-Java Bridge这样的桥梁的存在,但我不确定使用它会比简单的exec()快得多.有没有人有关于exec()的更多细节?

php shell exec php-java-bridge

5
推荐指数
1
解决办法
760
查看次数