Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7008551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:45:00+00:00 2026-05-27T21:45:00+00:00

I need to build a system that a user will send file to the

  • 0

I need to build a system that a user will send file to the server
then php will run a command-line tool using system() ( example tool.exe userfile )
i need a way to see the pid of the process to know the user that have start the tool
and a way to know when the tool have stop .

Is this possible on a Windows vista Machine , I can’t move to a Linux Server .

besides that the code must continue run when the user close the browser windows

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:45:01+00:00Added an answer on May 27, 2026 at 9:45 pm

    Rather than trying to obtain the ID of a process and monitor how long it runs, I think that what you want to do is have a "wrapper" process that handles pre/post-processing, such as logging or database manipulation.

    The first step to the is to create an asynchronous process, that will run independently of the parent and allow it to be started by a call to a web page.

    To do this on Windows, we use WshShell:

    $cmdToExecute = "tool.exe \"$userfile\"";
    $WshShell = new COM("WScript.Shell"); 
    $result = $WshShell->Run($cmdToExecute, 0, FALSE);
    

    …and (for completeness) if we want to do it on *nix, we append > /dev/null 2>&1 & to the command:

    $cmdToExecute = "/usr/bin/tool \"$userfile\"";
    exec("$cmdToExecute > /dev/null 2>&1 &");
    

    So, now you know how to start an external process that will not block your script, and will continue execution after your script has finished. But this doesn’t complete the picture – because you want to track the start and end times of the external process. This is quite simple – we just wrap it in a little PHP script, which we shall call…

    wrapper.php

    <?php
    
      // Fetch the arguments we need to pass on to the external tool
      $userfile = $argv[1];
    
      // Do any necessary pre-processing of the file here
      $startTime = microtime(TRUE);
    
      // Execute the external program
      exec("C:/path/to/tool.exe \"$userfile\"");
    
      // By the time we get here, the external tool has finished - because
      // we know that a standard call to exec() will block until the called
      // process finishes
      $endTime = microtime(TRUE);
    
      // Log the times etc and do any post processing here
    

    So instead of executing the tool directly, we make our command in the main script:

    $cmdToExecute = "php wrapper.php \"$userfile\"";
    

    …and we should have a finely controllable solution for what you want to do.

    N.B. Don’t forget to escapeshellarg() where necessary!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to build a rule-based system that can be run and developed in
I need to build a scripting interface for my C# program that does system
I will build a system where I want to reduce single-point-of-failures, and I need
I'm building a system that will send verses of scripture to subscribers over e-mail.
Situation I run a build system that executes many builds for many project. To
I need to build web application that will do: build web pages. build template
Need to install a font on all user's machines that will use the application
If I were to build a newsletter emailing system, I will need to be
We need to build a system capable of processing 40,000 messages per second. No
I need to build a online project monitoring system for my project. Can anyone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.