Run a PHP script in the background while using WAMP server in the local mechine

Discussion in 'PHP' started by nayanjyotionline, Sep 29, 2010.

  1. #1
    Hi,

    I have a mail script to that will take a long time to process, let me call it form2.php

    Now i post from form1.php to form2.php.

    I like to run the form2.php in the background so that the user will not wait for executing the form2.php.

    I have used exec and shell_exec but not success.

    I am using latest WAMP server in my local mechine.

    Thanks
     
    nayanjyotionline, Sep 29, 2010 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    If you have cURL enabled, fork a background process using exec which will complete the process and you can happily give message to the user saying his request is queued :)
     
    mastermunj, Sep 29, 2010 IP
  3. ivan.kristianto

    ivan.kristianto Active Member

    Messages:
    136
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    ivan.kristianto, Sep 29, 2010 IP
  4. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #4
    how about running a cron ??
     
    Bohra, Sep 29, 2010 IP
  5. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #5
    cron can serve the purpose very well if the process is not time based, as in it need not run immediately the user submits request OR if batch processing is not an issue.

    But the case mentioned seems to require a background process fork.
     
    mastermunj, Sep 30, 2010 IP
  6. nayanjyotionline

    nayanjyotionline Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    But I am working with WAMP on my local mechine exec is not working there. How exec works there?
     
    nayanjyotionline, Sep 30, 2010 IP
  7. nayanjyotionline

    nayanjyotionline Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    But I am working with WAMP on my local mechine exec is not working there. How exec works there?
     
    nayanjyotionline, Sep 30, 2010 IP