S
S
skonoplich2014-02-24 17:18:18
PHP
skonoplich, 2014-02-24 17:18:18

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

4 answer(s)
V
Vladimir, 2014-02-24
@azrail_dev

system("cmd /c C:[path to file]");
Print something to the screen, php should not exit. Well, or dig into the apache settings.

G
Grigory Tumakov, 2014-02-25
@VokaMut

exec('file.bat'); - this is how it works for me
ps Do you have a server on windows?

S
Sergey, 2014-02-24
Protko @Fesor

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

L
lepjep, 2016-10-07
@lepjep

https://www.youtube.com/watch?v=nZi5BHtErpg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question