Jump to content

Recommended Posts

Hi,

I want to run a Java program form my PHP code using shell_exec command. But problem is it works in my local apache server but not on remote server.

In remote server it gives

'Error occurred during initialization of VM Could not reserve enough space for object heap' :(

Can any one point out what is different in remote server than my local server?

$java_cmd = "java -cp some_jar.jar JavaClassName $target_path $outputFile";
$java = shell_exec($java_cmd); 
echo("\n\noutput " . $java)

 

This java command runs perfectly in remote server's command prompt. I have to add some jar in classpath  which is of 6MB in size. I have removed that 6MB jar but still gives the same error.

 

I'm surprised even

java -Xms512m -Xmx1024m -XX:MaxPermSize=128m -version
Or simply 
java -version

also gives same error. It means that simple VM can't starts form PHP :(

 

Can anyone help me please?

Thanks

Regards

-Nahid

Link to comment
https://forums.phpfreaks.com/topic/110037-problem-of-shell_exec-in-php/
Share on other sites

Hi, I've tried with separate shell script invoke by exec("run.sh"). My run.sh invoke that java, but still same problem. Most probably Apache can't invoke JVM. Is there any alternative to run that Java program? Anyway to make different thread, or any other technique? My need is very simple , just run that java program with some parameters and placing some jars in classpath.

Thanks

Regards

-Nahid

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.