Grails provide some incredibly easy ways to create and launch external processes. Simply define a string and call execute on it and you will have started an external process!
def command = "php " + pathToPhpFolder + "/my_script.php $myParam1 $myParam2"; command.execute();
This is the simpler approach, but it is not perfect because you may have problems with the params you pass, especially if they contains spaces. So a more safer (but still very easy) way is this:
def command = ["php", pathToPhpFolder + "/uploader.php", myParam1, myParam2]; command.execute();
These way all the parameters will be passed exactly as parameters, even if they contains spaces.
Process control
You may want to manage the external process and, for example, kill it if it goes in timeout. Here is the easy way:
def process = command.execute(); process.waitForOrKill(MY_TIMEOUT);
These instructions will launch the process and wait for a MY_TIMEOUT time before killing the process. The only things not exactly nice is that if the process timeouts, you will not have any exception so you may need to implement a way to determine if the process completed correctly or if it was killed (i use a status variable).
That's all!