I call a python script from PHP but i run script in background because i don't want to wait after script to finish, so i use > /dev/null 2>/dev/null &
with shell_exec
.
This is the code where i call:
shell_exec("C:\\Python27\\python C:\\xampp\\htdocs\\testing.py > /dev/null 2>/dev/null &");
in python script i have a simple write file:
fileName = "temp.txt"
target = open(fileName, 'w')
for x in range(1, 59):
target.write("test" + str(x) + " ")
target.close()
When i call script from PHP
with shell_exec("C:\\Python27\\python C:\\xampp\\htdocs\\testing.py");
it's working but webpage it's waiting after script to finish and i don't want that, so i called with > /dev/null 2>/dev/null &
but now, the code doesn't run.
Any ideas why code doesn't working when i want to run in background?
Thanks!
LE:
Changed /dev/null/
with nul
and still no working.
Now i call shell_exec("C:\\Python27\\python C:\\xampp\\htdocs\\testing.py > NUL 2> NUL &");
and it's working but page still wating after script to finish.