0

I'd like to know whether it is possible to have PHP run commands on a set loop, without the need of a user to be actively viewing it on a browser.

For example, mail sending - I'd like to be able to have this loop run, even when I close the browser, until I command it to stop.

$name = "Foo";
$to = $row['email'] //imagine it was fetched from a database;
mail($to,"Hello ".$name."! you won a million dollars!","Just kidding!");

After looking it up, I've noticed that some people mentioned it is possible to run PHP scripts as processes, I'd love to know if such a thing can be done, and if so I'd appreciate any help regarding the case

Thanks in advance!

Radicate
  • 2,934
  • 6
  • 26
  • 35

1 Answers1

0

You can use a queue manager like rabbitmq or beanstalk.

http://www.rabbitmq.com/

http://beanstalkapp.com/

or you can set tasks with cron.

How to create cron job using PHP?

Community
  • 1
  • 1
Canser Yanbakan
  • 3,780
  • 3
  • 39
  • 65