简体   繁体   中英

How to test PHP max_execution_time and default_socket_timeout with a simple PHP script?

I discovered that in php (on linux at least) the sleep(seconds); does NOT count toward timeouts!

So, my question is, what can I use "instead" of sleep(300); etc in a simple php script to test these timeouts?

(I'm trying to debug some php run via cgi/fastcgi, on php newer than 5.4 where safe mode was removed. Although deprecated setting's still present in our old php.ini, set to off.)

You can simply create a while(true) {} loop. You can save the current time() before the loop & break after X seconds have passed if you want to wait less than 300 seconds.

Right after I posted question here, I looked into time etc and went with a time() + 30 > time etc...can post exact usage tomorrow (need get zzz now), but it seemed to work. I see now someone also posted a while true option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM