I need to run a Python script file in exe from PHP under Windows 10, specifically it is the vosk-client.exe file, if I run the file from CMD command prompt it works perfectly but if I run it from PHP with exec(), shell_exec() or `` doesn't work and I don't get any response.
$com = "C:/Users/joe/AppData/Local/Programs/Python/Python311/Scripts/vosk-cli.exe -i file.wav -o file.ddt";
exec($com, $output, $retval);
echo "Returned with status $retval and output:\n";
print_r($output);
I need to execute the command from PHP
I already solved it, a PHP file must be created with the exec() command and it must be called from another PHP file through php -q but placing the path where php.exe is, the file voicetext_vosk.php contains the exec() that runs the pyton .exe script for example:
$com = "c:/xampp/php/php.exe -q
c:/xampp/htdocs/callcapture/webApp/callcapture/voicetext_vosk.php
c:/audio/2024/03/11/10/20240311_103400_GWKF.wav";
$output=null;
$retval=null;
echo $com."<br>";
exec($com, $output, $retval);
echo "Returned with status $retval and output:\n";
print_r($output);