开发者

storing java executable that is callable via php

开发者 https://www.devze.com 2023-03-20 15:41 出处:网络
so I\'m planning to have a PHP site being able to execute a java app using exec().... my question is, where should I store the actual jar file for the java app, should I put them in one of the folder

so I'm planning to have a PHP site being able to execute a java app using exec()....

my question is, where should I store the actual jar file for the java app, should I put them in one of the folders in Apache's www, or should I put them in an outside folder that is inaccessible by apache

does it开发者_如何学Python even matter? I'm concerned with the security implications of these choices....


Sounds rather painful... you'd be firing up a JVM for every hit on the page. Not even considering the security issues, consider the load this is going to be put on your system.

You'd probably be better off using a proper Java server like Tomcat.

As far as where to put it, that's mostly irrelevant. PHP's exec() functions work at the file system level, and couldn't care less about your http document root and whatnot. As long as you've got the permissions and paths set properly, it can be anywhere on your machine.


When you use Java using exec from php you run it on behalf of Apache user. So IMHO this directory can be accessible to Apache. However (as pointed by dog in comment), it should not be in Apaches DocumentRoot or the .jar file must not be accessible by HTTP.

IMHO better architecture can contain another Java server (lightweight Jetty or Tomcat) exposing web service (restfull or soap). Your site should call this web service on Java server. Another way is putting queue manager beetween them (or simply create queue in database). There are lot of better solutions.

0

精彩评论

暂无评论...
验证码 换一张
取 消