When I make a command in PHP like:
exec('java -version > test.txt');
the file test.txt is created but with an error inside :
There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory.
An error report file with more information is saved as:
/tmp/hs_err_pid25505.log
The error report file does not exist at this location.
When I try to execute the same command in the shell window, it works:
openjdk version "1.8.0_101"
OpenJDK Runtime Environment (build 1.8.0_101-b13) OpenJDK 64-Bit Server VM (build 25.101-b13, mixed mode)
The command i'm trying to execute is actually not java -version
but a more complicated one. However, the result is the same.
I think the problem comes from PHP. Until now I have tried to increase memory_limit but to no avail. I've seen people having similar problems but the solutions proposed don't work.