andrewgarn Posted June 20, 2008 Share Posted June 20, 2008 I have a created a complex page which cycles through a set of data and updates the information on the database. Sometimes it works fine, but usually it takes a long time, then firefox gives me an option to "download" the page. I presume this is something to do with the page timing out, I dont have access to the php.ini file so i cant change that. Is there any way to stop this from happening in the php file itself? Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/ Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 Check out set_time_limit() in the PHP Manual. Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570405 Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 <?php set_time_limit(999); ?> Same problem with it at the top Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570412 Share on other sites More sharing options...
Jabop Posted June 20, 2008 Share Posted June 20, 2008 Sometimes it works fine, but usually it takes a long time, then firefox gives me an option to "download" the page. This seems like it's not outputting the headers properly. If it was a time limit it would error out telling that the time to process has exceeded the max. Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570413 Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 Sometimes it works fine, but usually it takes a long time, then firefox gives me an option to "download" the page. This seems like it's not outputting the headers properly. If it was a time limit it would error out telling that the time to process has exceeded the max. didnt realise php pages needed headers, <-- must sound stupid but all my php is self taught my experimenting. currently most of my php pages just have php code in them, and as the page is just designed to process, not specifically to output anything Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570421 Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 Can we see the code? Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570422 Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 Can we see the code? I pmed it to you, please dont share the code publically Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570431 Share on other sites More sharing options...
Jabop Posted June 20, 2008 Share Posted June 20, 2008 Change your code so it's not a hazard to post it publicly, if you want help. Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570432 Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 Oh, I think I helped you with this script, lol. But it was much simpler before. Umm...so do you know after how long it sends you the file? Like, 30 seconds, 45 seconds, 300 seconds? Any idea? Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570437 Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 Oh, I think I helped you with this script, lol. But it was much simpler before. Umm...so do you know after how long it sends you the file? Like, 30 seconds, 45 seconds, 300 seconds? Any idea? Roughly 30 seconds. and yes it is quite complicated, the long load time is fine as the pages will be run automatically by an online cron service and not be viewed by users. Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570438 Share on other sites More sharing options...
lemmin Posted June 20, 2008 Share Posted June 20, 2008 Does it also send the file in Internet Explorer? Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570440 Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 Does it also send the file in Internet Explorer? Not sure, just loaded it in IE and it loaded properly 3 times running but it loaded much faster than 30secs so it might not be timing out like in FF. Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570444 Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 The code is here: http://idire.freehostia.com/updatetracking.txt to view. Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570451 Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 as a side question, i might be going crazy, but why doesnt this work? <?php INSERT INTO CHANGE ( id_status, username ) VALUES ( 'today', 'user1' ) ?> #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CHANGE ( id_status, username ) VALUES ( 'today', 'user1' Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570480 Share on other sites More sharing options...
lemmin Posted June 20, 2008 Share Posted June 20, 2008 From looking at your code, I wouldn't be surprised if the issue was memory related. it seems like you just keep copying variables with no real reason to. Why do you copy the variables like $overall_rank when you don't use the previous one? Since there isn't anything obviously wrong with the code and since it is possible that there is a memory issue, I would suggest trying to clean up some variables. You could even do: $c[0][0] = $c[0][0] - $r["overall_rank"]; And, systematically, nothing above would be changed and you would use two less variables. Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570482 Share on other sites More sharing options...
lemmin Posted June 20, 2008 Share Posted June 20, 2008 as a side question, i might be going crazy, but why doesnt this work? <?php INSERT INTO CHANGE ( id_status, username ) VALUES ( 'today', 'user1' ) ?> #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CHANGE ( id_status, username ) VALUES ( 'today', 'user1' CHANGE is a reserved word, you need to put back quotes around it to make it literal. INSERT INTO `CHANGE` ( id_status, username ) VALUES ( 'today', 'user1' ) Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570484 Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 thank you, that fixed that, still having the problem on firefox though. I removed one variable and replaced with the split variable as you suggested. Its now timing out on both ie and FF Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570516 Share on other sites More sharing options...
lemmin Posted June 20, 2008 Share Posted June 20, 2008 How many rows are returned from your first query of "SELECT * FROM user where track = 'Yes'"? Try commenting out that outer while loop and manually set $username to a test one that exists and see if it still times out. I'm pretty sure it won't time out if you do that, and if it doesn't I think I know what the problem is. Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570568 Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 How many rows are returned from your first query of "SELECT * FROM user where track = 'Yes'"? Try commenting out that outer while loop and manually set $username to a test one that exists and see if it still times out. I'm pretty sure it won't time out if you do that, and if it doesn't I think I know what the problem is. 13 currently, users register with the site to add themselves to the tracker Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-570578 Share on other sites More sharing options...
andrewgarn Posted June 21, 2008 Author Share Posted June 21, 2008 Still having the same problem Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-571081 Share on other sites More sharing options...
andrewgarn Posted June 22, 2008 Author Share Posted June 22, 2008 any ideas? Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-571746 Share on other sites More sharing options...
lemmin Posted June 23, 2008 Share Posted June 23, 2008 Did you try: commenting out that outer while loop and manually set $username to a test one that exists and see if it still times out.? Link to comment https://forums.phpfreaks.com/topic/111147-php-timeout/#findComment-572312 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.