Getting PHP to run a Python script

前端 未结 4 939
时光取名叫无心
时光取名叫无心 2020-12-06 05:24

I am trying to run a Python program using PHP. Here\'s the code

$command = \'/usr/local/bin/python script.py file\';
$temp = exec($command, $output);
         


        
4条回答
  •  死守一世寂寞
    2020-12-06 06:07

    Few checkpoints

    • script.py should be pass full path, eg, /home/abhinav/script.py
    • script.py should be executable, chmod +x script.py

提交回复
热议问题