douxue4395 2010-01-06 07:26
浏览 103
已采纳

Java与Drupal-6 / PHP

I really dislike PHP, but am pretty comfortable in Java. I have a stable Drupal installation that has been deployed to an Apache/Linux server. I don't know if the server currently supports Java. (What does it take to do that? I have programming in desktop apps for Java but never online before.)

For developing new modules for my site, is there any way that I can write Java and somehow have it work with the PHP?

  • 写回答

3条回答 默认 最新

  • duanhan5388 2010-01-06 07:52
    关注

    To use Java on a (web) server, you'll probably need:

    • an installed Java VM,
    • a servlet container or a full application server if you'll use some advanced techs like EJBs.

    Theoretically you could run a web application without an installed servlet container, but that needs an embedded servlet container or some hacking, though. Most servlet containers or app servers can be used as frontend web servers, but if you decide to move them one step backwards behind the Apache httpd, then with the mod_jk connector plugin, you'll be able to load balance or proxy requests from the Apache web server to your servlet container (note, not just Tomcat: Glassfish and JBoss can be used as well) and hide the Java container from direct web access and provide an additional layer of security and load handling.

    If somehow you'd like to run PHP and Java together, that is possible with some mild hacking: use Quercus (which is a Java implementation of the PHP language) on a suitable server (I'd prefer Glassfish v3), pack your app as a war file and you'll be able to run most PHP applications on a Java app server (and no, this doesn't mean any kind of sluggishness).

    And, of course, if you push back the original Drupal application from the frontend Apache to a backend Java servlet container, then you'll be able to run Java and PHP apps side by side and the only job left for Apache is to load balance. If you are interested, check the Quercus and Drupal howto.

    One more thing I forgot: if you'd like to create new Drupal plugins/modules in Java, that would only work with Quercus or if the Java and PHP apps are connected via web services or a cross-language framework like Protobuf or Thrift (so the view part could be Drupal plugin written in PHP, and business logic in Java running on a remote server). Note that I'm not an experienced Drupal plugin developer.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀