App Engine Win SDK PHP超时停留在30秒,应该是60?

时间:2016-06-02 20:07:40

标签: php google-app-engine google-app-engine-php

我使用Google最新的Windows App Engine PHP SDK v1.9.38在本地开发服务器上运行一些长时间运行的脚本,出于某种原因,他们会在30秒内超时。错误是例如"致命错误:请求已中止,因为它超过了最长执行时间。在[我的脚本路径] \ timertest.php第8行"

自动缩放的超时时间应为60秒!我不确定我在这里丢失了什么...我在一个脚本中进行了各种文件处理但是我编写了一个测试脚本,看看它是否在30秒内失败了,它确实。脚本是:

<?php

$a = 1;

do
    {
    syslog(LOG_INFO, $a.' Sleeping for 10 secs...\n');
    sleep(10);
    $a++;
    }
while($a < 8)

?>

输出是:

INFO: 1 Sleeping for 10 secs...\n
INFO: 2 Sleeping for 10 secs...\n
INFO: 3 Sleeping for 10 secs...\n
ERROR:root:php failure (255) with:

stdout:

X-Powered-By: PHP/5.5.26

Content-type: text/html

<br />

<b>Fatal error</b>:  The request was aborted because it exceeded the maximum execution time. in <b>[my script path]\timertest.php</b> on line <b>8</b><br />

INFO     2016-06-02 20:52:56,693 module.py:788] default: "GET /testing/timertest.php HTTP/1.1" 500 195

我认为这是某个地方的配置错误,但不确定是什么或在哪里。我的app.yaml很标准:

application: ak2016-1
version: 1
runtime: php55
api_version: 1

handlers:
# Serve php scripts.
- url: /(.+\.php)$
  script: \1
  login: admin

和php.ini也是:

google_app_engine.disable_readonly_filesystem = 1
upload_max_filesize = 8M
display_errors = "1"
display_startup_errors = "1"

正如我所说,这只是本地开发SDK服务器的一个问题,我不会对在线直播方面感到困扰,因为我处理的文件是本地的(并且需要保留)。< / p>

感谢您的任何建议等!

1 个答案:

答案 0 :(得分:2)

我在Request Timer文档上部署了应用示例,但无法复制您的问题。我的请求在大约60秒后全部超时:

$ time curl https://<project-id>.appspot.com/timeout.php 
Got timeout! Cleaning up...
real    1m0.127s
user    0m0.021s
sys     0m0.010s

然后我复制了您的代码app.yamlphp.ini以查看是否可以复制该代码,并在我的系统日志中收到以下内容:

INFO: 1 Sleeping for 10 secs...\n
INFO: 2 Sleeping for 10 secs...\n
INFO: 3 Sleeping for 10 secs...\n
INFO: 4 Sleeping for 10 secs...\n
INFO: 5 Sleeping for 10 secs...\n
INFO: 6 Sleeping for 10 secs...\n
INFO: PHP Fatal error:  The request was aborted because it exceeded the maximum execution time. in /base/data/home/apps/.../timeout2.php on line 9

但是,如果您在30秒后仍然遇到请求超时问题,我建议将违规代码移至task queues。我希望这有帮助!