LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > PHP > 408 error

Reply
 
Thread Tools Display Modes
  #1  
Old 11-19-2010, 06:54 PM
BCata BCata is offline
New Member
 
Join Date: Nov 2010
Posts: 3
Default 408 error

Hello,

I have a script that requires some intensive calculations every now and then. On apache, I simply use set_time_limit(0). But when doing this on litespeed it doesn't do anything and I get the 408 error ( as shown below ). If I use ob_flush() every few secs inside the script it works properly, but cannot change all the long running scripts to include a flush command. Is there a way to set "Connection Timeout" from within a php script? Because I do not want to raise that value for the entire server, but only for a select few files.

"408 Request Time-out

This request takes too long to process, it is timed out by the server. If it should not be timed out, please contact administrator of this web site to increase 'Connection Timeout'."
Reply With Quote
  #2  
Old 11-19-2010, 07:27 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
As a quick solution, increase Server->Tuning->Connection Timeout (secs)

php in suExec mode or not? are you on a shared hosting or your own VPS?
Reply With Quote
  #3  
Old 11-19-2010, 07:59 PM
BCata BCata is offline
New Member
 
Join Date: Nov 2010
Posts: 3
I know about Server->Tuning->Connection Timeout (secs). But that would increase the security risk for my clients. I only really need an increased timeout for a few files, some executed by CRON and some executed manually ( as an example, I have a file that checks email addresses... That takes a while to query each domain and check response time and so on. Execution time is often around 10 mins to process everything. That file runs once a week at most. ).

PHP suEXEC is used ( at least it is reported in WHM "Apache suEXEC" ON ). I have a VPS from WiredTree.
Reply With Quote
  #4  
Old 11-20-2010, 03:44 AM
xing xing is offline
LiteSpeed Staff
 
Join Date: Oct 2003
Location: Los Angeles, California
Posts: 380
First, the webserver should never let any connection idle beyond the set connection timeout limit. Having no timeout is a much more of a security/ddos risk. Let say you have all your 20 backend lsapi php processes behind litespeed doing heavy calculation for non-specified amount of time with no timeout control and zero 0 lsapi php processes left to handel the real traffic. Just imagine the outcome.

You should not call this long running script through a web server wether its LiteSpeed or Apache. Call it directly via crond, fcrond, etc. There you can have the script run to infinity without affecting the operation of the website itself.

Calling a long running script behind a webserver is fundamentally the wrong way to do things.

This might have "worked" with Apache but if anyone finds out the link to this script, then anyone can bring down your website.
Reply With Quote
  #5  
Old 11-20-2010, 04:05 AM
BCata BCata is offline
New Member
 
Join Date: Nov 2010
Posts: 3
I am a programmer with almost 10 years of experience. I know about the pros and cons on running such long processes. First, the file is protected so only the admin can run it. Second it is protected to only run once every week, no matter how many times you click on it. So it cannot bring the server down.

The script needs to run when I import large lists of emails ( around 500.000 emails per list ). It needs to check every email if it is valid ( proper checking with string validation, domain ping and mx record check ). The thing is, some are invalid and then the script has to wait 2-3 second for the internal check timeout. 2-3 seconds times 1000 takes a long time just to wait. That is the actual issue and script. That file cannot run under CRON since I need the results right after the upload.

So my question stands: is there a way to increase connection timeout limit from the PHP script on a litespeed server, like it is possible on Apache?
Reply With Quote
  #6  
Old 11-20-2010, 09:07 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
set_time_limit(0) only change PHP internal limit, has nothing to do with any web server, including apache and LSWS. Apache is likely to have a very long connection timeout, so it works if you change set_time_limit(), it does not mean that the function really did anything to Apache.

If you want it work like Apache, you have to increase the connection timeout.
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:48 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.