Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing commands may hang on Windows XP for some programs #124

Open
GoogleCodeExporter opened this issue Jun 16, 2015 · 6 comments
Open

Comments

@GoogleCodeExporter
Copy link

It's a PHP bug 44942:
https://bugs.php.net/bug.php?id=44942

When executing wmic.exe to fetch software/hardware information, it will hang:

  ob_start();
  $ret = system("C:\Windows\System32\wbem\wmic.exe path win32_computersystemproduct get uuid");
  $output = ob_get_contents();
  ob_end_clean();

Tried using WScript.Shell COM object and its method Exec() instead, but it 
failed as well.

We may introduce ExecuteCommand function to javascript API.

Another option is to create a helper executable for eg. exec-cmd.exe that would 
work around the PHP bug, it would be called like this:

  system("exec-cmd.exe \"C:\Windows\System32\wbem\wmic.exe path win32_computersystemproduct get uuid\"");

Original issue reported on code.google.com by czarek.t...@gmail.com on 3 Oct 2014 at 3:56

@GoogleCodeExporter
Copy link
Author

In PHP bug 44942 there is a comment by claudix with a supposedly workaround fix 
by making calls to session_start() and session_write_close(), and using 
proc_open/proc_close functions instead of system().

Original comment by czarek.t...@gmail.com on 3 Oct 2014 at 5:09

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

A FINAL SOLUTION TO THIS ISSUE. Use a command like this: "echo | command...". 
For example:

  $output = shell_exec("echo | {$_ENV['SYSTEMROOT']}\System32\wbem\wmic.exe path win32_computersystemproduct get uuid");
  if ($output) echo "Command succeeded. Output=".$output;
  else echo "Command failed.";

Original comment by czarek.t...@gmail.com on 4 Oct 2014 at 6:30

@GoogleCodeExporter
Copy link
Author

[deleted comment]

1 similar comment
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Original comment by czarek.t...@gmail.com on 21 Oct 2014 at 10:40

  • Added labels: Restrict-AddIssueComment-Commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant