我注册了GitHub并分叉了。我试着根据Symfony2运行测试。我输入了> phpunit,但是每次经过一些测试之后,我突然从内存中得到了的消息:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 40 bytes) in ...\Symfony\Component\HttpFoundation\HeaderBag.php on line 37
然后,测试结果是这样的:
503 Service Unavailable503 Service Unavailable50
我在一台Apache2 +PHP5.3服务器上运行Varnish3.0。我的问题是Varnish抛出了许多503服务不可用的错误,所以我添加了一个变通方法,如下所示:
if http_code = 503 and cookie(REDIRECTED) = false
set-cookie REDIRECTED=true
header 307 redirect to same page // try again, maybe this time it doesn't fail
else if http_code = 503 and cookie(REDIRECTED) = tru
这里有一个PHP函数:
function TryGetJSON($URL) { //Attempts to retrieve the JSON at a URL, script terminates if failure
function LogAndDie($msg) { error_log($msg); die(); }
for($attempt = 0; $attempt < 3; $attempt++) { //Try 3 times to fetch URL
$JSON = file_get_contents($URL); //Attempt t