5

Possible Duplicate:
Call Java method from PHP5

How can I call a java application from a php application, taking note that they reside on the same server?

No WebServices or any http stuff.

Can I do that and how can I do it?

Community
  • 1
  • 1
Catalin Marin
  • 1,252
  • 1
  • 11
  • 18

1 Answers1

5

You can use php's exec(...) function to call java on the command line.

Naftali
  • 144,921
  • 39
  • 244
  • 303
  • @Catalin Marin Which could potentially be a huge security risk for a web app. Be sure that your code uses a static, unchangeable string to call your Java code if you follow this path. You will have to ask yourself "What commands could a web user execute?". Especially if you are running your web server as root on a *nix system or an administrator on Windows. – bakoyaro Nov 22 '11 at 14:44
  • @bakoyaro: Anyone running their web server as root (except in some very narrow, special circumstances, mainly in the embedded world) needs to immediately visit careers.SE and hire a competent sysadmin. – derobert Nov 23 '11 at 07:21
  • I strongly doubt this is what the original poster had in mind. – Alexander Trauzzi Jan 28 '14 at 23:21