PHP exec function
•
26 Oct 2011, 08:29
•
Journals
I want to start a java program (.jar file) with a php script got this script in my www folder (wampserver) and want to start file.jar(that is also in my www folder.) How can i do this already looked up at google but this code always fail. So somebody any idea. (the program need to open at the foreground.)
grtz
grtz
exec('java -jar jar.jar', $output);
print_r($output);
?>
and i tried this:
<body>
<?php
exec('C:\WINDOWS\System32\notepad.exe', $output);
print_r($output);
?>
</body>
i tried this on 127.0.0.1/test.php
and my browser keeps loading so nothing happend, also tried this without the $output but same result.
Anything you execute using exec must terminate.
system('start notepad');
$command = "c:\\Windows\\notepad.exe";
exec($command);
?>
it works like this now the only problem is it wil run as a proces on the background and the User is SYSTEM any idea how to change this?
E: echo exec('file.jar');