Run windows command in php

前端 未结 5 922
梦毁少年i
梦毁少年i 2021-02-08 15:20

Is it possible to run windows command line code from php ? My windows command line code is:



        
5条回答
  •  甜味超标
    2021-02-08 15:56

    If you are able to run your commands manually from the command-line, but not via WAMP, than the user the Apache Service runs as does not have the needed permissions to execute your commands and binaries (nor interact with the desktop if it is GUI related).

    By default, Apache service run under user account: nt authority\system

    Change it to your custom user (user with administrative rights) by following below steps,

    1. Hit Windows+R which opens Run
    2. Type "services.msc" which opens list of windows services
    3. Find and select your apache service and open its properties
    4. Go to Logon tab and change the account From “Local System” to another user/account
    5. Restart your Apache service

    Happy coding :-)

提交回复
热议问题