Answer the question
In order to leave comments, you need to log in
How to implement a .bat file call from php?
I need to call a .bat file from php, and exec and shell_exec are not suitable, or I just don’t know how to cook them.
The fact is that if you run a bat file that locally calls the php script, then it does not crash on time, and if you call the php script directly from the web on a remote machine, it crashes on a 504 timeout.
If anyone knows how to fine-tune exec and shell_exec so that they are correctly called on Windows .bat file please tell me. It didn’t work for me right away, because apparently the script also crashes on timeout ....
Thank you!
Answer the question
In order to leave comments, you need to log in
system("cmd /c C:[path to file]");
Print something to the screen, php should not exit. Well, or dig into the apache settings.
exec('file.bat'); - this is how it works for me
ps Do you have a server on windows?
have you tried set_time_limit ?
In general, if you need to run a program on demand and not wait for it to finish, then ...
www.php.net/manual/ru/function.exec.php#86329
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question