Run JAR in PHP

I currently have a site on my local computer that uses PHP to invoke the .jar program. It works great when I run it on my local machine.

When I upload it to my host and try to run the same .jar file, I do not get output ...

Do you know why this is so? Do I need to modify PHP.ini on my remote host to allow jars to be executable or something else?

Any help is appreciated. Thanks Phil

EDIT:

Code snippet: shell_exec ("java -jar news.jar get phil")

get and phil are two parameters for news.jar. I use Windows XP on my local machine and I just have simple PHP MySQL hosting on the Internet. Does hosting like this not support shell_exec () calls?

+3
source share
1 answer

Code snippet: shell_exec ("java -jar news.jar get phil")

It is very likely that this will not work out of the box on shared hosting, because it is shell_exec()completely disabled, or execution is javanot available for your shared hosting package or Java virtual machine that runs jar does not have the right to do what the bank wants to do.

You should be able to at least figure out whether you can even run Java by using shell_execute instead, by providing variables and (see the linked man page) and seeing what they contain after the call. exec$output&$return_var

It is best, however, to talk with the provider and ask what is possible and what is not.

+4
source

Source: https://habr.com/ru/post/1731682/


All Articles