1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Infinitely running PHP script

Discussion in 'HTML & JavaScript' started by barigain, Jan 3, 2014.

  1. barigain

    barigain Junior Member

    Joined:
    Aug 23, 2012
    Messages:
    100
    Likes Received:
    12
    How to run a PHP script on the server that will run after the browser is closed? Can they do this? I have shells to some sites, there trying to run the script.
    The script prints the time in .txt file. Launched, closed the browser - works.
    Worked script already 1:30 minutes longer does not work.
    I also need to organize a permanent job script. Is there any way to get around this limit?
    Everywhere it is necessary to such a limit on the duration of the script?
    Thanks in advance.
     
  2. SEOEmpire

    SEOEmpire Registered Member

    Joined:
    Dec 14, 2013
    Messages:
    55
    Likes Received:
    32
    Check if you can create a "cron job" on your server. That way you can run the script every minute and without a webbrowser.
     
    • Thanks Thanks x 1
  3. miedy

    miedy Senior Member

    Joined:
    May 17, 2012
    Messages:
    1,007
    Likes Received:
    463
  4. mindlesswizard

    mindlesswizard Supreme Member

    Joined:
    Sep 3, 2010
    Messages:
    1,359
    Likes Received:
    282
    Occupation:
    Designer/Developer, Internet Marketer
    Location:
    in the shade of Everest
    Yeah "cron job". I have custom made crawlers that works on the VPS and does amazing work. :)
     
  5. Anger66

    Anger66 Registered Member

    Joined:
    Jul 11, 2009
    Messages:
    96
    Likes Received:
    53
    Location:
    localhost
    • Thanks Thanks x 1
  6. Chees

    Chees Regular Member

    Joined:
    Apr 16, 2010
    Messages:
    476
    Likes Received:
    151
    or you can use something like tmux which will keep a terminal open.
     
  7. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,062
    Likes Received:
    2,872
    Gender:
    Male
    Use cron jobs. If you have cpanel then go to cron jobs manager and set the cron from there. Google "cron jobs tutorial" for more info.
     
  8. funque

    funque Newbie

    Joined:
    Dec 27, 2013
    Messages:
    21
    Likes Received:
    1
    Except of cron jobs, you can try the following:
    Code:
    ini_set("max_execution_time", "99999");  
    set_time_limit(0);
    ignore_user_abort(1); 
     
    • Thanks Thanks x 1
  9. barigain

    barigain Junior Member

    Joined:
    Aug 23, 2012
    Messages:
    100
    Likes Received:
    12
    Thank you all! I figured out the problem and will code new version of my script! Thank you!
     
  10. TorrentCoder

    TorrentCoder Newbie

    Joined:
    Feb 3, 2014
    Messages:
    15
    Likes Received:
    1
    Use
    Code:
    set_time_limit(0);