简体   繁体   中英

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. 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.

<?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

#!/bin/bash

./Run &
wait $!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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