PHP Show CMD Command Prompt Window (Windows)

QuestionsCategory: QuestionsPHP Show CMD Command Prompt Window (Windows)
Brightn-n-Fresh Staff asked 7 years ago

Usually, you would want to hide the CMD window. In my case, I'll be doing some tests with PHP+CLI. It will be mighty useful if PHP could be made to launch a CLI popup. But alas, I can't find a way to make it to.

The following command should have made it work, but it doesn't:

START "PHP AE2" CMD /K DIR

The PHP code in question is based on proc_open():

$proc=proc_open($cmd,array(
    0=>array('pipe','r'), // STDIN
    1=>array('pipe','w'), // STDOUT
    2=>array('pipe','w')  // STDERR
),$pipes);
// ....some stream stuff....
$return=proc_close($proc);

Although the command runs fine, the popup doesn't show up. I suspect this is a feature of Apache. Is there a way to completely detach the CMD from its parent?

Also, I'll be substituting DIR with a small script/batch/program that initializes the environment, so it is important that I can execute a program after the popup shows up.

(This is mostly for educational purposes and won't follow into production.)

(13)