djschoch Posted February 12, 2009 Share Posted February 12, 2009 I have a page that queries a MySQL database to retrieve words in order to build a crossword puzzle. The page displays my standard header and the empty grid, then starts the process. I have logic to control how many iterations of the outermost loop is executed. When it hits the max, it displays the filled-in grid to show how far it's gotten. The PHP program, or page (or browser??) times out after one minute. If I put in a smaller iteration limit (one that completes in less than a minute), the program displays the grid showing the progress. I've played with the various "timeout" settings I can Google that relate to PHP and MySQL, but nothing I've done seems to alter the 1 minute processing limit. Help! -Dan- Quote Link to comment https://forums.phpfreaks.com/topic/144855-page-timing-out/ Share on other sites More sharing options...
drisate Posted February 12, 2009 Share Posted February 12, 2009 did you try ini_set('max_execution_time', 300); //300 seconds = 5 minutes Quote Link to comment https://forums.phpfreaks.com/topic/144855-page-timing-out/#findComment-760130 Share on other sites More sharing options...
premiso Posted February 12, 2009 Share Posted February 12, 2009 The browser is probably timing out. You can use ob_flush and flush to output items to the browser in iterations, say every 10 loops you echo a "." to the browser. Here is an example of that: <?php set_time_limit(0); // unlimited for ($i=0;$i<10000;$i++) { if (($i%100) == 0) { echo '.'; ob_flush(); flush(); } } ?> This will only work in certain browsers. I know it works on FF 3+. See if that helps you out at all. Quote Link to comment https://forums.phpfreaks.com/topic/144855-page-timing-out/#findComment-760147 Share on other sites More sharing options...
djschoch Posted February 12, 2009 Author Share Posted February 12, 2009 I already had the max_execution_time set to 300 (5 minutes) in my php.ini, so that was already set. The other suggestion (using the echo and ob_flush/flush) extended the execution time to about 2-1/2 minutes, but it still terminated at that time. Btw, I'm using FF 3, and haven't tried it on other browsers yet. So it helped a bit, but I'd love to have it set up to run 5, 10, 20 or even 30 minutes (if needed). Thanks for the suggestions! -Dan- Quote Link to comment https://forums.phpfreaks.com/topic/144855-page-timing-out/#findComment-760256 Share on other sites More sharing options...
premiso Posted February 12, 2009 Share Posted February 12, 2009 I already had the max_execution_time set to 300 (5 minutes) in my php.ini, so that was already set. The other suggestion (using the echo and ob_flush/flush) extended the execution time to about 2-1/2 minutes, but it still terminated at that time. Btw, I'm using FF 3, and haven't tried it on other browsers yet. So it helped a bit, but I'd love to have it set up to run 5, 10, 20 or even 30 minutes (if needed). Thanks for the suggestions! -Dan- Using the PHP CLI and extending the max execution time to 30 minutes, this should be possible. As for running it in the browser, it is not probable, due to memory on the side with the browser etc. Quote Link to comment https://forums.phpfreaks.com/topic/144855-page-timing-out/#findComment-760264 Share on other sites More sharing options...
djschoch Posted February 12, 2009 Author Share Posted February 12, 2009 Thanks so much for your help! I'm a newbie to php and wasn't aware you could execute php from the command line. I actually just migrated from PC to Mac (wow!), and you set me on a path to using the Mac command line, and installing php and MySQL locally, etc. This will help me keep my development environment separate from my website, too (especially if my admin web page could pull data from my Mac and post it to my web server!). I'm optimistic that approach will help me crack this nut. (Unfortunately, I'm an old dog at programming and just see too many options right now!) Thanks again, -Dan- Quote Link to comment https://forums.phpfreaks.com/topic/144855-page-timing-out/#findComment-760689 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.