学习源头:

https://blog.csdn.net/ltx06/article/details/53992905

 

system(“nohup ./test.py $s &”);

这个不会在后台运行,php会一直挂起直到test.py结束。

system(“nohup ./test.py $s >>log.txt &”);

这样写才能在后台运行因为system函数启动一个程序并希望保持在后台运行,

必须确保该程序的输出被重定向到一个文件或者其它输出流去,否则PHP 会在程序执行结束前挂起。

比如:

1、 system(“nohup ./test.py $s >>/tmp/output.txt &”);

2、 system(“nohup ./test.py $s > /dev/null 2>&1 &”); 

       (2>&1是错误输出转到标准输出,想读错误输出就加2>&1,不加读不到错误)

 

   或 system(“nohup ./test.py $s > /dev/null &”);

 

 

system('/usr/bin/nohup '.config('iqiyi.phppath').'php ../artisan expon '." $datas ".'>> '.config('iqiyi.logpath').date('Y').'log.txt &');

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-27
  • 2021-06-12
  • 2022-12-23
猜你喜欢
  • 2021-06-19
  • 2021-04-30
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
  • 2022-12-23
相关资源
相似解决方案