SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast spamonkey8's Avatar
    Join Date
    Feb 2006
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Execute command but don't wait?

    Is there a way to run a command-line program or command but not wait until it has exited before continuing with the script's execution? I don't need the output of the command, I just don't want the script to hang while this outside program runs its course. (PHP5/Apache2 under Windows)

    Thanks all!

  2. #2
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://php.net/popen

    Take a look on user atampone at NOSPAMFORME dot trdsupra dot com comment from 20-Jun-2005 03:26

  3. #3
    SitePoint Enthusiast spamonkey8's Avatar
    Join Date
    Feb 2006
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried his method exactly and had problems. Running "dir /S D:\ > outputfile" caused it to create the file and lock it so that it can't be deleted, but never write to it. I tried running shell_exec('start dir /S D:\ > outputfile'), which should work the same way, but still had problems.

    Have you ever had this working?

  4. #4
    SitePoint Enthusiast spamonkey8's Avatar
    Join Date
    Feb 2006
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found the problem. That command causes the batch file to run the command "start dir /S D:\ > outfile", which means that the output of the start command is being written to the file, not the command that start is forking off (dir).

    Is there a way around this?


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
  •