I have to call a php "build.php" from a button action and the php will call a python script and should return immediately.
The action:
<form method="get" action="build.php">
<input type="hidden" name="branch" value="master">
<input type="submit" value="Build Master" id="btnMaster">
</form>
The build.php
<?php
if(isset($_GET['branch']))
{
$output = shell_exec('/usr/bin/python /Users/testuser/gitroot/buildOnGuest.py --dest /Users/testuser/Builds --branch ' . $_GET['branch'] . ' 2>&1 &');
}
elseif (isset($_GET['tag']))
{
$output = shell_exec('/usr/bin/python /Users/testuser/gitroot/buildOnGuest.py --dest /Users/testuser/Builds --tag ' . $_GET['tag'] . ' 2>&1 &');
}
?>
So the python script is executed in the background (&) and the php should return immediately to the main page. Is it possible and how ?