rantsh Posted March 12, 2007 Share Posted March 12, 2007 Hey all, I have the following code: $i=0; while($i++<15) { mail("[email protected]",date("d m Y H:i:s"),"This is email # $i "); echo "mandado $i <br>"; sleep(60); } Now, I know my server has a 30 second max_execution_time setting... nonetheless, this code runs successfully!!!. Now, this is actually better for me (for the application I need to run)... Yet I'm concerned of why it's being allowed to run for 15 minutes if max_execution_time is set to 30. PHP.NET says: Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running. But I don't see how my query could be included here, I don't have perfect english but for what I understand it means that the overhead caused by the actual action of sending the email does not affect the max_execution_time, but isn't the time the script is sleeping included either??????? Thx, Roderick Link to comment https://forums.phpfreaks.com/topic/42365-sleep-and-max_execution_time/ Share on other sites More sharing options...
mbtaylor Posted March 12, 2007 Share Posted March 12, 2007 I dont thing sleep is counted in php script execution time, but I could be wrong. Link to comment https://forums.phpfreaks.com/topic/42365-sleep-and-max_execution_time/#findComment-205506 Share on other sites More sharing options...
donynam Posted March 12, 2007 Share Posted March 12, 2007 I have a suggestion: try to talk to company which owns this host whether this host support/enable .htaccess. if It does then your problem can be solved instead. Link to comment https://forums.phpfreaks.com/topic/42365-sleep-and-max_execution_time/#findComment-205515 Share on other sites More sharing options...
rantsh Posted March 12, 2007 Author Share Posted March 12, 2007 I have a suggestion: try to talk to company which owns this host whether this host support/enable .htaccess. if It does then your problem can be solved instead. We own the server... and the process I need to run will be run from a crontab... how can I solve this through a .htaccess file? Link to comment https://forums.phpfreaks.com/topic/42365-sleep-and-max_execution_time/#findComment-205588 Share on other sites More sharing options...
donynam Posted March 12, 2007 Share Posted March 12, 2007 You can put this file to in the same directory where your php script is going to run. Then in the .htaccess file you can override max_execution_time on fly. in .htaccess file max_execution_time = 0; //none stop execution you can also override other server or environment variable by using this way. hahaha, if you own the server why should you do this ? If I were you I will try to use windows Task manage or *nix crontab. Link to comment https://forums.phpfreaks.com/topic/42365-sleep-and-max_execution_time/#findComment-205595 Share on other sites More sharing options...
rantsh Posted March 12, 2007 Author Share Posted March 12, 2007 hahaha, if you own the server why should you do this ? If I were you I will try to use windows Task manage or *nix crontab. I'm going to use crontab, thing is that I'm required to process a different batch every X seconds in a single process (don't ask me why), which is why I'm bound to use sleep... Link to comment https://forums.phpfreaks.com/topic/42365-sleep-and-max_execution_time/#findComment-205609 Share on other sites More sharing options...
donynam Posted March 12, 2007 Share Posted March 12, 2007 Anyway I have seen some programmers using this kind of code, but I'm not dare to try it, because I though this kind of script might occupy some treads or processes forever and will consume some system resource. Link to comment https://forums.phpfreaks.com/topic/42365-sleep-and-max_execution_time/#findComment-205618 Share on other sites More sharing options...
rantsh Posted March 12, 2007 Author Share Posted March 12, 2007 ... script might occupy some treads or processes forever and will consume some system resource. I agree, but the boss is the boss.....!!!! (hehehe) Link to comment https://forums.phpfreaks.com/topic/42365-sleep-and-max_execution_time/#findComment-205626 Share on other sites More sharing options...
donynam Posted March 12, 2007 Share Posted March 12, 2007 haha, your can do some business with your boss already by asking your boss to upgrade the system because of this reason. Link to comment https://forums.phpfreaks.com/topic/42365-sleep-and-max_execution_time/#findComment-205635 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.