如何为apache提供cmd权限?

I'm working on a php application that pulls github repositories to the server. Github webhooks call the php files.

I want to execute a cmd command using php. I assume I need apache permissions but I don't know how to give them.

The php code below creates an mkdir.bat and a gitclone.bat and runs them. The mkdir runs successfully, it creates an empty folder, but the gitclone doesn't create any folders or files. When I run the gitclone manually it does create folders and files.

file_put_contents("mkdir.bat", "mkdir test");
exec("mkdir.bat");

file_put_contents("gitclone.bat", "git clone https://github.com/gutyina700/WPTG.git");
exec("gitclone.bat");

I executed your code in my computer

file_put_contents("gitclone.bat", "git clone https://github.com/gutyina700/WPTG.git");
exec("gitclone.bat 2>&1",$o);
print_r($o);

the extra code is to check the output from cmd and it returned "git command not exsists" so you only have to add a line as

<?php
putenv("PATH=C:\Program Files\Git\cmd");
file_put_contents("gitclone.bat", "git clone https://github.com/gutyina700/WPTG.git");
exec("gitclone.bat 2>&1",$o);
print_r($o);
?>

This was working properly.