Question about set_time_limit (0?

Source: Internet
Author: User
Question about set_time_limit (0? On the iis server, why does set_time_limit (0) in php not work?


Reply to discussion (solution)

Why is it ineffective?

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 output time out. And the error 500 is reported.

Indicates that php has not been used in iis...

500 error is not set in php. ini display_errors = On, and the while loop $ time_end-$ time_start should always be equal to 0

I tested successfully in the apache environment. I don't know if it is related to the service.

500 error is not set in php. ini display_errors = On, and the while loop $ time_end-$ time_start should always be equal to 0


Why should $ time_end-$ time_start always be equal to 0?

I tested successfully in the apache environment. I don't know if it is related to the service.


How should I set it in iis?

I can change 80 to a smaller value.

Exceeds the maximum execution time? Enable the error prompt function.

Oh, added set_time_limit (0); that has nothing to do with the maximum execution time.

Enable the error prompt function to check whether an error is reported.

Troubleshoot for several reasons:
1. whether php runs in safe mode. If yes, set_time_limit is invalid.

2. the IIS server is configured with a timeout value and has a higher priority. even if you set a no-timeout value for php, the server will still perform timeout processing due to the timeout mechanism. Therefore, a fatal error will be triggered after the timeout, this is the cause of 500 error.
Refer to this article: http://www.iisadmin.co.uk /? P = 7

Oh, added set_time_limit (0); that has nothing to do with the maximum execution time.

Enable the error prompt function to check whether an error is reported.


I turned on the error prompt function and found no error prompt in the log.

After the problem is solved, it is really the iis7 problem:
IIS7-> FastCGI Settings-> double-click "php-cgi.exe"-> "activity timeout" item is set to 70 by default, I changed to the maximum value, 2592000.

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.