Skip to content

Instantly share code, notes, and snippets.

@emulsion-io
Created May 5, 2017 16:37
Show Gist options
  • Save emulsion-io/ded8ab38f5a93f98b1365ecc30ac5a2c to your computer and use it in GitHub Desktop.
Save emulsion-io/ded8ab38f5a93f98b1365ecc30ac5a2c to your computer and use it in GitHub Desktop.
Exécute un script python sans paralyser php
<?php
session_start() ;
$cmd1 = 'python -u /var/www/blabla/test/Test.py';
$proc=proc_open($cmd1,
array(
array("pipe","r"),
array("pipe","w"),
array("pipe","w")
),
$pipes);
$proc_status=proc_get_status($proc);
exec('kill -9 '.$proc_status['pid']);
proc_close($proc);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment