如何在不为Java Bridge添加tomcat服务器的情况下将Java后端添加到现有的PHP站点? [英] How do I add a Java backend to an existing PHP site without adding a tomcat server for Java Bridge?

查看:104
本文介绍了如何在不为Java Bridge添加tomcat服务器的情况下将Java后端添加到现有的PHP站点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Currently we're using PHP for our websites. Now we're thinking about writing the backend in Java, because of the type safety of the language, and the availability of all kind of tools for Java. I've been reading about Java Bridge and now I'm wondering how to set this up.

我们已经通过Apache使用PHP.我读到要使用Java Bridge,还需要安装Tomcat.这意味着我有两个服务器(Apache和Tomcat),并且我需要为后端增加安全性,因为它突然向全世界开放...我是否缺少某些东西?是否有另一种无需额外服务器即可建立PHP-Java连接的方法?通常如何做?

We're using PHP already through Apache. I read that to use Java Bridge I need to install Tomcat as well. That means I have two servers (Apache and Tomcat), and I need to add security to the backend, because it is open to the whole wide world suddenly... Am I missing something? Is there another way to make the PHP-Java connection without an additional server? How is this usually done?

任何有关如何执行此操作的指导或链接,或有关如何进行设置的任何最佳做法,将不胜感激.我没有找到官方的Java Bridge网站非常清楚. 谢谢!

Any directions or links on how to to do this or any best practices on how to set it up are greatly appreciated. I didn't find the official Java Bridge site very clear. Thanks!

推荐答案

我目前正在测试Zend Java桥的使用.两周前,我确实测试了 PHP/Java桥开源解决方案 .这确实需要您将Java类放入部署在Web服务器中的战争中(我确实使用过Tomcat 6). Zend解决方案不需要Web服务器.如果将业务逻辑放在普通的Java类中,则只需将类包装在一个(或几个)jar中.然后,您将Zend Java桥守护程序启动到JVM中,将Zend Java桥jar以及您自己的jar的

I am currently testing the use of the Zend Java bridge. Two weeks ago, I did test the PHP/Java bridge open source solution. This one does require that you put your java classes into a war deployed in a web server (I did use Tomcat 6). The Zend solution does not require a web server. If you put your business logic in plain java classes, you simply wrap your classes in one (or several) jars. You then start the Zend java bridge daemon into a JVM, passing to the -classpath the Zend Java bridge jar aswell as your own jar's

从Dos窗口中获取的信息:

Ex from a dos windows:

C:\ Development \ ToolsPHP \ ZendServer \ bin> java -classpath javamw.jar; mybusinesslogic.jar -Dzend.javamw.port = 10002 com.zend.javamw.JavaServer .

在这里,我必须指定一个端口,因为网桥的默认端口10001已被使用(使用netstat -a检测端口冲突).请注意,仅当您的php脚本在由Zend服务器(社区版或商业版)管理的Apache服务器上执行并且Zend Java Bridge服务正在运行时,Zend解决方案才有效,其Zend Server管理控制台的端口设置为10002.

Here, I had to specify a port since the 10001 port, which is the default for the bridge, was already in use (use netstat -a to detect port conflicts). Note that the Zend solution only works if your php script is executed on the Apache server managed by the Zend server (community or commercial edition) and that the Zend Java bridge service is running, with its port set to 10002 with the Zend server admin console.

要实现我的业务逻辑,我计划使用简单的Java pojo,Spring,JPA和Hibernate.

To implement my business logic, I plan using simple Java pojo's, Spring, JPA and Hibernate.

这篇关于如何在不为Java Bridge添加tomcat服务器的情况下将Java后端添加到现有的PHP站点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆