I
I
ibr_982018-02-20 14:49:33
Network administration
ibr_98, 2018-02-20 14:49:33

Why does the php script on the hosting work for the first few seconds and then turn off?

Hello!
I launched a script with an eternal loop on a free hosting (that is, I opened a new tab and went to my site where the code itself was) that wrote data to a file, then closed the tab and the script worked fine for the first few seconds, but then stopped, sorry for the noob question, but how can this problem be solved?
Thank you

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Puma Thailand, 2018-02-20
@opium

Run it in the console, you won't be able to bypass system variables for timeouts

A
Alexey Rudkovsky, 2018-02-20
@AlexRudkowskij

You have encountered a timeout: php.net/manual/ru/function.set-time-limit.php
You can try to specify , but this is not entirely correct set_time_limit(0)

F
Farhod Daniyarov, 2018-02-20
@fudeglan

We treat infinity through set_time_limit(0)
Closing the browser through ignore_user_abort
But if ngix is ​​installed, then it also has limitations and it will cut down your script, giving a 503 error.
Try to start by just looking in the browser what will happen after a minute, after 15 minutes. Will work or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question