@
@
@Twitt2018-02-27 14:54:32
PHP
@Twitt, 2018-02-27 14:54:32

How to stop a PHP script that sends emails in a loop?

there is a php script that sends emails to everyone in a loop, but if I want to stop it at one moment, then I just restart the server. are there any workarounds?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vladimir Skibin, 2018-02-27
@megafax

Yes, in the script itself, in the loop, look for any external factor by which to exit - the presence of a file / entry in the database / other things, and according to this condition, do exit / die.

S
synapse_people, 2018-02-27
@synapse_people

you can find out its PID and execute kill -9 PID
or killall -9 php

M
mrWan, 2018-02-27
@mrWan

make a button redirect to the same page

<button onclick="location.reload()">остановить</button>

O
Oleg As, 2018-02-27
@eXcNightRider

in a database, in some table, perhaps you have one - where various parameters are stored, create a parameter, for example, enable_sendmail and a value of 0 or 1. In your script that sends letters, make a request to the database and check this parameter before each sending a letter, then any convenient way to stop the process

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question