0

I've got a need for some php code to launch more than one instance of Shell exec and run a command. At present my code trys to run both commands in the same window which makes the second command fail. As the commands need to run at the same time a separate windows is best for me, the command is launching an adobe product. Any help would be much appreciated.

1 Answers1

0

You need to use threading to do that. One simple method would be to trigger your shell exec calls through ajax calls, so you can hit 2 parallel ajax url's to trigger your shell exec.

Most by default iis servers allow up to 6 parallel connections from the same client.

Simos Fasouliotis
  • 1,383
  • 2
  • 16
  • 35
  • Thanks Simos that sounds like a good idea, is PHP not a good way to achieve this? I'm new to Dev and don't have any experience with AJAX calls. – jaykay287 Jun 06 '17 at 07:43
  • @jaykay287 PHP is a very suitable language to do that - you just need to add some javascript (try jquery for example) that will do the ajax calls to php. – Simos Fasouliotis Jun 06 '17 at 08:41
  • Thank you so much for your replies Simos I can see how to do the calls now, I actually need the call to open premiere pro, render a video and then wait for a call back. Do you know if the call can be set to wait? AJAX calls seem to be fire and forget? – jaykay287 Jun 06 '17 at 14:57
  • No, ajax is not fire and forget, you wait for the response from php. It can have several statuses like fail, success, etc... It returns a response once php completes or gives error or timesout. If your php script is completed before your render finishes, then it's the way you run shell exec that fires and forgets. Read this on how to wait till the job is finished : https://stackoverflow.com/questions/7296288/php-shell-exec-wait-for-script-to-finish – Simos Fasouliotis Jun 07 '17 at 07:46