Jump to content

PHP timeout?


andrewgarn

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.