Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call nbtstat command from PHP (64-bit OS)

Tags:

php

shell-exec

I'm trying to call the nbtstat command from PHP using shell_exec(). Apparently that doesn't work because I'm using a 64-bit system.

echo shell_exec("nbtstat");

I've done some research and it seems that the problem is caused by the fact that Windows 64-bit defaults to \Windows\SysWOW64 as System32 folder. But nbtstat is located in the normal \Windows\System32 folder.

In normal applications you can call Wow64DisableWow64FsRedirection to disable this redirection, but I haven't managed to find this in PHP yet.

Is there a way to actually call these commands from PHP within a 64-bit Operating System?

like image 991
Arolition Avatar asked Jul 03 '26 12:07

Arolition


1 Answers

Add "\Windows\Sysnative" to the end of your environment path.

like image 178
roylaurie Avatar answered Jul 05 '26 03:07

roylaurie