Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does PHP exec() command launch a DOS window? Can I hide this?

Tags:

php

apache

cgi

I am executing a PHP script as a cgi-script on Windows XP, web server is Apache 2.2 which is encrypted using phtmlenc(). This is opening a blank DOS prompt (cmd.exe window) during execution.

This the test script test.php I have placed my script inside cgi-bin directory:

#! C:/PHP/bin
exec(WHOAMI);

When I launch the script through Internet Explorer by typing localhost/cgi-bin/test.php I can see a DOS window popup.

  1. Can I suppress this by changing Apache configuration or PHP configuration?
  2. The original script is encrypted using a phtmldec() and hence I cannot change the actual exec() call
  3. Can I edit the PHP to put some headers to hide or suppress the DOS window?
like image 833
user1249555 Avatar asked Jun 12 '26 04:06

user1249555


1 Answers

You cannot hide the window because that is under the control of the operating system, not PHP or Apache. And since whoami is a console application it creates a console when run.

By the way, 'WHOAMI' should be in quotes.

like image 200
Jon Avatar answered Jun 13 '26 17:06

Jon