2017-03-16 4 views
0

내 PHP 스크립트의 실행 시간이 끝나기 전까지는 긴 폴링 아약스 스크립트를 다루고있었습니다. 나는 다음과 같은 한 : 나는 예상대로 PHP 최대 실행 시간이 끝나지 않습니다

<?php 
set_time_limit(11); 
ini_set('max_execution_time',11); 
echo ini_get('max_execution_time'); 

$i=0; 
while (true) { 
    $i++; 
    echo "<br>".$i; 
    sleep(1); 
} 
echo "END"; 
?> 

내가 첫 번째 라인을 얻을; "11". 하지만 스크립트는 계속 계산 중입니다 ... 페이지가 계속 울립니다 ... 언제 완료 될지 모르겠습니다. 제안 사항이 있습니까? 나는 서버에 접근 할 수 없다. ehost.com에있다.

+0

먼저 1 ...... (12)이 치명적인 에러 이후 후 11 .php on line 7 무엇을 원하니? – b2ok

+0

스크립트는 계속 카운팅을 계속합니다. ... 바로 800 개 이상을 울리고 있습니다 ... 그래서 ... –

+0

OS 의존적 인 것처럼 보입니다. 즉, Linux sleep() 시간은 무시되므로 max_execution_time은 실제 실행 시간을 나타냅니다. 잠자기 시간을 포함하지 않습니다. 참조 : http://stackoverflow.com/questions/740954/does-sleep-time-count-for-execution-time-limit – manassehkatz

답변

0

Check this docs.

Warning
This function has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.

아마도 문제 일 수 있습니다. 어쨌든 또한 safe mode's docs에서 : C 초과 11 초 최대 실행 시간 : \ XAMPP \ htdocs를 \ php7 \ timeneverstop

Warning This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.

+0

그게 처음 이었지만, [php documentation] (http://php.net/manual/en/features.safe-mode.php)에서 "이 기능은 PHP 5.3.0부터는 사용이 권장되지 않았습니다. "PHP 5.4.0에서 제거 된"및 내 버전 5.6.29 –

+0

[This (http://stackoverflow.com/questions/12094839/php-set-time-limit-does-not-work-safemode-is- 꺼짐)도 도움이 될 것입니다. – Condorcho

+0

또한 [이 체크] (http://stackoverflow.com/questions/7493023/why-doesnt-set-time-limit-work-as-expected), 특히 [이 답변] (http://stackoverflow.com/ a/7493056/7431119) – Condorcho