First I try php code to run java.
=== php ===
<?php
exec("java -cp xx.jar xxxxx");
?>
Nothing response when I run it from browser.
Then I write php extension (c++) .
===c++ ===
string c_java(){
return system("/usr/bin/java -cp xxx/javase/javase.jar xxxxxxxxxxxxx");
}
Nothing response too. Why I can't use php extension to run java command ?.
any one knows that?
Using php extension to run java command
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Using php extension to run java command
You should look at the different execution functions. The exec() function does not return much of the output, but does have some parameters that do. Other funcitons like passthru() will show more output in the browser.
(#10850)
Re: Using php extension to run java command
When I run that php code from linux command line , I can get the right response.
If request come from browser , It will return nothing.
-----program flow -------
Browser -> request apahce -> php -> php extension -> c++ -> call java -> java virtual machine , this flow happen some error .
I guess java virtual machine can't be executed in apache thread.
If request come from browser , It will return nothing.
-----program flow -------
Browser -> request apahce -> php -> php extension -> c++ -> call java -> java virtual machine , this flow happen some error .
I guess java virtual machine can't be executed in apache thread.