Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 29-06-2009
Member
 
Join Date: May 2009
Posts: 258
How can i stop a PHP Script

I am having a PHP script that is gone annoying for me. It is doing a repetitive act several times or simply involves a lot of number crunching or similar. Also some times i am afraid it may get time out. How can i stop my PHP script getting time out ? Please help..
Reply With Quote
  #2  
Old 29-06-2009
Member
 
Join Date: Apr 2008
Posts: 4,086
Re: How can i stop a PHP Script

First you should consider a manuscript that more than 30 seconds into place requires a suitable web server, but if there is a special instance where it is, or indeed if you have PHP on your local server / machine operation shall you can adjust the following settings:-

Quote:
<?php
set_time_limit(500);//increase time out to 500 seconds
?>
Also Flush the output buffer. Flushes the output buffers of PHP and whatever backend PHP is using (CGI, a web server, etc). This effectively tries to push all the output so far to the user's browser. flush() has no effect on the buffering scheme of your web server or the browser on the client side. Thus you need to call both ob_flush() and flush() to flush the output buffers. Several servers, especially on Win32, will still buffer the output from your script until it terminates before transmitting the results to the browser.
Reply With Quote
  #3  
Old 29-06-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: How can i stop a PHP Script

I think you need to use use echo and flush.flush() has no effect on the buffering scheme of your web server.Even the browser may buffer its input before displaying it. Netscape, for example, buffers text until it receives an end-of-line or the beginning of a tag, and it won't render tables until the </table> tag of the outermost table is seen.

Some versions of Microsoft Internet Explorer will only start to display the page after they have received 256 bytes of output, so you may need to send extra whitespace before flushing to get those browsers to display the page.
Reply With Quote
  #4  
Old 29-06-2009
Member
 
Join Date: May 2009
Posts: 258
Re: How can i stop a PHP Script

Thanks mate for the quick help and sharing this valuable code. I increased the time out session to 500 and i hope it'll continue to work fine. Thank you again.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How can i stop a PHP Script"
Thread Thread Starter Forum Replies Last Post
How to stop cross-site script in Internet Explorer 8? Aaghaz Technology & Internet 4 17-02-2011 10:32 AM
want to stop auto generation of script on ajaxproject KADRI Software Development 4 25-01-2010 10:36 PM
Word 2008 + bibfuse: no script in script menu deval4u Software Development 5 06-04-2009 12:53 PM
Stop the execution of a script leon m Technology & Internet 3 26-01-2009 06:53 PM
Problem with script in order to open another script in an extra window Samsher Software Development 2 14-01-2009 01:25 PM


All times are GMT +5.5. The time now is 07:42 PM.