Fabrice
5/5/2017 - 4:37 PM

Exécute un script python sans paralyser php

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);

?>