How to run a php script after 5 minutes?

In General, I want to do such a thing. Let's say the user just registered and I need to send him an email, but not immediately, and after 5 minutes. Any ideas on how this can be implemented? I would like the most efficient solution, thanks!
March 19th 20 at 08:45
4 answers
March 19th 20 at 08:47
When you register to set the status, for example, 1. The script that is specified in the cron, to avoid all the statuses 1 to send email and to put the status 2.
March 19th 20 at 08:49
Only through cron (Google knows)

This is the optimal and only)) solution.

While writing, read kamenty misteriosa above - he writes))

Create our database table with the queue.
For example, the user regnulsya, the script puts a job in the queue and specifies the execution time +5 minutes from the current one.
Every minute Cron runs a script that looks in a queue and if the execution time of the task in the past - takes the job and the job itself is marked as executed.
Well, it's no details if))
March 19th 20 at 08:51
You can create a task and stick it in place with 5 minute delay.
March 19th 20 at 08:53
But it doesn't have cron, and write the demon.
All the same infrastructure as code and not a cron job. sitting somewhere on the side.

And generally it is better it is better to use a queue

Find more questions by tags PHP