Christian Christian - 1 year ago 215
PHP Question

PHP Show CMD Command Prompt Window (Windows)

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:


The PHP code in question is based on

0=>array('pipe','r'), // STDIN
1=>array('pipe','w'), // STDOUT
2=>array('pipe','w') // STDERR
// ....some stream stuff....

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
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.)

Abs Abs
Answer Source

I am bit late to answering this question, but to help close this question here is my answer.

The command is correct but you need to get Apache to interact with the desktop. If you are on a windows machine, just go to services, find Apache and make sure you tick the "Allow Service to Interact with desktop" checkbox.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download