I would like to run a Python script on a Windows Server (IIS) system with the PHP shell_exec("python hubbeldibubbel.py parameter). If I start the Python script normally via the console, the script works, but not via web access.
What can be the cause? How can I debug this?
The Python script should only write something to a txt file at the moment.
The php-script:
<?php
$string = $_SERVER['REQUEST_URI'];
$command = '"C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Python.exe" C:\\inetpub\\vhosts\\...\\httpdocs\\nw.py ' . $string;
$output= shell_exec($command);
echo $output;
?>
The python script:
import sys
string = sys.argv[1]
datei = open('datei.txt','a')
datei.write("aaa" + string)
print(string)
I tried other php commands.
You miss one slash here
AppData\Local, should beAppData\\Local.