I have written a web program in php that needs to stop a windows service and start's it when run like this:
exec('net stop spooler'); //to stop printer spooler
exec('net start spooler'); //to start printer spooler
the above codes doesnt stop the printer spooler and i think i know why, because when i open up cmd- command prompt normally and type net start spooler
i get access deny...but when i open cmd - command prompt as administrator the command line will work, so i think apache also needs to be given administrator permission so that the above code can work but i cant figure out how to grant the code to run as administrator.
the printer spooler windows service can be found when you click start > type run> in run command type services.msc then you will see printer spooler as one of the windows services...when the above code runs...it should stop that service or starts it