How to run a PHP Script forever

Hi,

Its been 3-4 days posting here,due to some work on the construction of some AutoBot Servers.At last ,it finally came to a stable end.Will soon be disclosed to you.

php script timeout or php script run forever


Introduction
Today i am gonna help some PHP developers want to run their server tireless with a PHP script.Its just an easy work around,so that the script will work out forever until a Fatal error or something happened.

What will you face without using this work around?

Yes it's simple.You will just get an error stating.

Fatal error : Maximum execution of 30 seconds exceeded.

The php's default maximum execution time is 30 seconds.


How to bypass the time restriction with just a single line of code or a function call?


<?php
ini_set('set_time_limit', 0);//Time limit is set to zero.That means infinite.
            //OR
ini_set('set_time_limit',1800);//Time limit is set to 1800 seconds ie,30 minutes.
?>

That's it you can make your php script run forever or for a limited amount of time.

Here is an advise,please code your script properly.So that it may end in an unwanted end loop.

For ever PHP scripts are mostly used in realtime web applications.

Enjoy coding...
Share on Google Plus

About Shihab Soft

I am Shihab, people used to call me a Security researcher or sometimes a Reverse engineer or sometimes a creepy hacker ;). Got a brain full of knowledge in different programming languages, and not more nor less I am a blogger too :).
    Blogger Comment
    Facebook Comment

4 comments:-

  1. Great Post, Actually PHP is a beautiful source for developing a database driven web application, I love this post, thanks for spending your time for discussing about this topic.
    Regards,
    PHP Course in Chennai

    ReplyDelete
    Replies
    1. Hi Roshini,

      I am so glad to here that this post is useful for you.
      Thanks for the time you have invested, commenting here.

      Delete
  2. This technical post helps me to improve my skills set, thanks for this wonder article I expect your upcoming blog, so keep sharing..
    Regards,
    Web designing course in chennai

    ReplyDelete
  3. In recent days Angular plays vital role to loading your site content in a fastest way, so it’s a required skill for everyone, thanks for sharing this useful information to our vision keep blogging.
    Regards,
    Angularjs training in chennai

    ReplyDelete

Don't be shy. Just, leave your comments. Iam so happy to assist you. And, don't forgot that, I am such a nice person who you are dealing with :)