Jump to content

Recommended Posts

I want to start my executable via exec. (or system or anything else really)

 

But once the shell based server starts (which stays running) the php just stays going waiting on the process to complete.

 

Can i start the app without having to wait on it to complete?

 

 

<?

shell_exec("c:\\server\\server\webstart.cmd");

 

 

?>

 

Link to comment
https://forums.phpfreaks.com/topic/233935-another-shell_exe-question/
Share on other sites

As a note. I've tried the system() recommended on php.net/manual

In my case webstart.cmd starts a second .bat file (which actually calls a 3rd)

From  WIDOWS to  start multilpe php scripts  from  a parent script and do not wait for child scripts to finish, from the parent.php creat  a X.bat file that contains all the commands to start child objects, something like:

start /B C:/[path_to_php]/php -f C:/child1.php > C:/[path_to_log1].txt
start /B C:/[path_to_php]/php -f C:/child2.php > C:/[path_to_log2].txt

and then run the X.bat width 
<?php
system("CMD /C X.bat");
?>

You'll have to background the process. Nothing to do with PHP. In Linux you would append & to the end of the command, Windows, I have no idea but I'm sure if you Google it you will find it.

 

I've been googling for 5 hours. I saw all the resluts for exec in google so i joined and posted my question.

 

I'm on a windows os.

 

The linux command is

exec("bla bla bla &") but that defiantly doesn't work for windows.

I just got done trying

 

system(php c:\script2.php)

 

But that too waits on the process to complete.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.