LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-20-2004, 09:46 PM   #1
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
PHP script timeout


I always get a 30s script timeout when I do a long database search (>30s) via a https connection from a remote place to an apache+PHP+PostgreSQL server.

Most strange is that my php.ini contains much longer script timeout value, and in fact I do not have the timeout when I do the same database search from within the LAN where the server resides.
I do not have the timeout when I access a static page or download a large file from the same server from the outside, either.

So it seems as if the timeout would only concern dynamic PHP pages and only if they are accessed from outside of the LAN.

Have you ever experienced such PHP behaviour? Is there a workaround?

Last edited by J_Szucs; 01-20-2004 at 09:47 PM.
 
Old 01-21-2004, 03:17 PM   #2
Pcghost
Senior Member
 
Registered: Feb 2003
Location: The Real Washington
Distribution: Debian, Android
Posts: 1,819

Rep: Reputation: 46
Try adding this to your php script immediatly before you begin the query

set_time_limit(20*60);

That allows for 20 minutes and solved a similar problem I had recently.

Last edited by Pcghost; 01-21-2004 at 03:18 PM.
 
Old 01-21-2004, 10:16 PM   #3
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
The set_time_limit(360) command has been there for a long time, yet I had the 30s timeout...

Presently I cannot easily reproduce the timeout as I do a database maintenance very often and the queries run quicker.

Yet, I am pretty sure the 30s timeout is there as always.
 
Old 01-22-2004, 11:38 AM   #4
looseCannon
Member
 
Registered: Dec 2003
Location: Little Rock, AR
Distribution: Fedora Core 2, AIX, HP-UX, Solaris, Whitebox
Posts: 193

Rep: Reputation: 31
I had a problem with this kind of thing a while back. It came down to two things. The first was it took a while for the script in the page to run since it was doing a lot of different things (db queries, copying files to servers, untarring things, etc.). The second problem was with the browser. If the browser wouldn't receive any data from the server within a given period of time, about 30 seconds or so, it would give up on loading the page.

I got around the problem by using "flush()" in the page. This would send the buffered portion of the page that had been built to the browser. That was the only change I made and it cleared the problem up. Using this method the browser can wait a lot longer, up to 5 minutes, for the page to completely load before it will give up.
 
Old 01-22-2004, 04:10 PM   #5
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
You may be right in that my script does not return anything to the browser until the query is fully completed. Though it could send the page header right at the beginning.

So I will try the flush() command to force PHP to send the page header before the query is run.

However, if it is the browser that times out the connection, why do not I get the timeout when I connect to the server with the same browser but from a local client?

Anyway, thanks for the tip!

Last edited by J_Szucs; 01-22-2004 at 04:14 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Timeout after 30s (apache+php+postgreSQL) J_Szucs Linux - Software 6 06-07-2015 11:06 PM
Fedora 3 - PHP - Socket timeout b_whelan Linux - Software 2 09-29-2005 02:41 AM
PHP: Browser timeout workaround?? jpbarto Programming 2 08-05-2005 10:30 AM
Wireless hotspot client timeout script Joffe Linux - Wireless Networking 0 04-14-2004 10:12 AM
scripting help: boot script, loopback password, timeout undecipherable Programming 3 12-18-2002 10:15 AM


All times are GMT -5. The time now is 05:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration