SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Addict kivison's Avatar
    Join Date
    Dec 2004
    Location
    Whitley Bay, Tyne & Wear, UK
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Running script in the background

    Hello ppl

    I have an upload script that used to work quite happily uploading to one place. Now we have 4 portals we upload to and I have added switches to each portal. I would like to be able to upload to all of the portals at once in one script but I know that it would time out. I have already increased the php process time in the php.ini file.

    Is there a way of running a script in the background so i can set it away when I want to and not have to worry about the script timing out?

    I ahve been thinking about scheduled tasks but not sure what would happen if the script took too long to execute and also Scheduled tasks have to run at a certain time. I want to run the script when I want to.

    Thanks in advance.

    Keith

  2. #2
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try php exec function...

    Something like...

    PHP Code:
    <?php exec('php /root/to/script.php > /dev/null 2>&1 &');?>
    This will thread it... Use a DB file or something to request to if u need to know when the updates have all finished.

    This makes use of 'command line php'

  3. #3
    SitePoint Addict kivison's Avatar
    Join Date
    Dec 2004
    Location
    Whitley Bay, Tyne & Wear, UK
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    Im running th escript on a windows box so I assume it will be


    PHP Code:

    <?php exec('php c:\\www\\webroot\\script.php > ');?>
    Not sure what the rest is about but I will ahve a read up. Thank for the pointer

    Keith


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •