Enable shell_exec() in wamp server

后端 未结 10 1768
臣服心动
臣服心动 2021-01-05 17:22

Recently I have passed one issue on wamp server..I need to use the shell_exec() function in PHP for running some external shell script (some checksum file) . Bu

相关标签:
10条回答
  • 2021-01-05 18:13

    have you tried backticks? (in case safemode is OFF)

    `ls -hal`
    

    Windows equivalent would be

    `dir \AH`
    
    0 讨论(0)
  • 2021-01-05 18:17

    You need to disable safe mode in the php.ini located in the \Apache2\bin folder, not the php folder.

    Restart Apache2 service right after to load the new settings.

    0 讨论(0)
  • 2021-01-05 18:17
    <?php
    function _exec($cmd)
    {
        shell_exec('SCHTASKS /F /Create /TN _proc /TR "' . $cmd . '"" /SC DAILY /RU INTERACTIVE');
        shell_exec('SCHTASKS /RUN /TN "_proc"');
        shell_exec('SCHTASKS /DELETE /TN "_proc" /F');
    }
    _exec("mspaint.exe");
    ?>
    

    Rather a hack, but if you're trying to start anything with a gui, or hangs, this is what I found that works.

    0 讨论(0)
  • 2021-01-05 18:20

    Is not a "server problem". This configuration is not recommended. You must run the WAMP server in Administrator mode.

    Here are some information: PHP doesn't work with shell_exec(), system() or passthru()

    0 讨论(0)
提交回复
热议问题