Can't execute java applications through php

software development


Our site needs to execute a java application at some stage during a user’s visit. When executing any java command through php, the process dies with the error:

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

I have tried to run the simplest of java calls using:

<?php echo exec("/usr/bin/java -version"); ?>

which still give the above error.

I can execute the java application successfully through a shell account both from the command line using the java command and through the php script using the php CLI, but
not through the web (i.e through apache).

I’ve tried several things to try and get this to work including the -Xmx and -Xms command line flags to java, running it through a shell script and calling the shell script from php, emailing support, and the solution provided in this thread:

All to no avail! Any help would be greatly appreciated… i imagine someone must have run into this somewhere!!