Questions about Set_time_limit (0)?

Source: Internet
Author: User
Why is Set_time_limit (0) in PHP not useful under the IIS server?


Reply to discussion (solution)

How does it not work in the embodiment of?

Set_time_limit (0);
$time _start = time (true);
$chk = false;
while ($chk = = = False) {
$time _end = time (true);
if ($time _end-$time _start > 80) {
printf ("Time out!");
$chk = true;
}
}
This code does not play time out. and reported a 500 error.

It means you don't have to use PHP under IIS ...

500 error is not php.ini in display_errors = On not set, there is a while loop $time _end-$time _start should always be equal to 0

I tested it in the Apache environment. I don't know if it's about service.

500 error is not php.ini in display_errors = On not set, there is a while loop $time _end-$time _start should always be equal to 0


Why $time_end-$time _start should always be equal to 0?

I tested it in the Apache environment. I don't know if it's about service.


How should I set it up in IIS?

I can change the 80 by a little bit.

Exceeded the maximum execution time? Turn on the error prompt function to see.

Oh, add set_time_limit (0); That's okay with the maximum execution time.

Open the error notification function to see if there are any errors.

Several reasons to check:
1. PHP is running in safe mode, and if so, Set_time_limit is invalid.

2. The IIS server itself is configured with a time-out and a higher priority, even if you have PHP set does not time out, due to the server's time-out mechanism, still do time-out processing, so after the timeout will trigger a fatal error, which is the cause of the 500 error.
Refer to this article: http://www.iisadmin.co.uk/?p=7

Oh, add set_time_limit (0); That's okay with the maximum execution time.

Open the error notification function to see if there are any errors.


I opened the error notification function and found no error in log.

Problem solved, and sure enough is the problem of IIS7:
iis7->fastcgi Settings-double-click the "Php-cgi.exe" and "Activity timeout" item by default is set to 70, I change to Maximum, 2592000.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.