0

I'm trying to list running services on a windows server via php. Therefore I'm using shell_exec with winexe.

My script:

$cmd = "winexe --interactive=0 --user='***' --password='***' //192.168.***.** \"net start\"";
$output = shell_exec($cmd); 
echo $output;

Unfortunately on execution the page loads forever with no result. The command works on the command-line (Debian).

Anyone an idea?

Thanks in advance.

Jenz
  • 8,280
  • 7
  • 44
  • 77
cr1zz
  • 577
  • 1
  • 5
  • 16

1 Answers1

0

Save $cmd with correct format into a new bash file. Set cmd value for call this file. Remember set execution perms to this file. Check if your apache user has perms for exec winexe

===

Try to launch

    cat </dev/null | winexe --interactive=0 --ostype=1 --user=...
  • Tried to do: 1. Creating a temp.sh with php (content: #!/bin/bash winexe --interactive=1 --user=Administrator --password=xxx //192.168.xxx.xxx "net stop Tomcat6") 2. Executing the script via php (shell_exec) --- Script is running but page still loads forever. Perhaps something with the return? – cr1zz Apr 29 '14 at 09:26