dp20011 2016-03-21 21:14
浏览 19

PHP多语句执行背景

I have a PHP script that needs to run some background command line calls to create some files in the background. I do not want the user to have to wait until the command line stuff is done before the page loads. I have tried using the answers from other threads on SO and it is not working for me.

Here is what I have tried via exec() and shell_exec() to get it to run in the background:

'{ [multiple commands here] }  &> /dev/null &;

If it is helpful, this is the server info:

uname -or
2.6.39-400.17.1.el6uek.x86_64 GNU/Linux

lsb_release -irc
Distributor ID: OracleServer
Release:    6.4
Codename:   n/a
  • 写回答

1条回答 默认 最新

  • dongquxiao8545 2016-03-21 21:24
    关注

    Maybe this example will help you out. Replace the commands with your commands.

    <?php
    shell_exec("{ sleep 10; touch /tmp/asdf; } > /dev/null 2>&1 &");
    
    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制