Jump to content

Problem of shell_exec in PHP


nahidshahin

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.