简体   繁体   English

PHP脚本超时/未运行完成

[英]PHP script timing out/not running to completion

Part of a project I'm working on means running lots of benchmarks on cloud instances. 我正在从事的项目的一部分意味着在云实例上运行许多基准测试。 To make it easier on myself, I want to make them runnable via the web and get the output printed straight to the browser window. 为了使自己更轻松,我想使它们可通过网络运行,并将输出直接打印到浏览器窗口。

This seems to work fine, however, the script 'stops' after about 10 minutes of run time (ie the browser stops loading) - less than halfway through my benchmark, and I have no idea why. 这似乎很好用,但是,脚本在运行大约10分钟后“停止”(即浏览器停止加载),还不到我的基准测试的一半,我也不知道为什么。 SSHing into the server and calling top shows that the process is stopping as well - but it will complete if I call ./runscript.sh from the command line. SSH进入服务器并调用top表示该过程也正在停止-但是如果我./runscript.sh调用./runscript.sh它将完成。

<?php

set_time_limit(0);
ignore_user_abort(1);

header("Content-type: text/plain");


ob_implicit_flush(true);
ob_end_flush();

$old_path = getcwd();
chdir("UnixBench");
passthru("./runscript.sh");
chdir($old_path);
?>

In this instance, runscript.sh is simply 在这种情况下, runscript.sh只是

#!/bin/bash

./Run &
wait $!

在类似的情况下,我将脚本更改为每隔几秒钟发出一次空格

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM