I'm trying to execute a command through shell_exec
in php. But I'm getting an error.
My code :
shell_exec('groovy log_analyser1.groovy').
But I'm getting this error :
sh: groovy: command not found
Put groovy installation somewhere sane (/usr/local
or /opt
or whatever your ops team allows you) and then call groovy with the absolute path.
Since you have currently installed in in your root
users ~
, other users (like the user your php/httpd runs as) don't have access to it (for good reasons).
Even if you would use the same user as your php/httpd and use GVM there you will have a hard time to make this work properly, since GVM relies on some scripts to run. So just copy from your GVM files (~/.gvm/groovy/<version>
) where it's easy for all users to access it.