How PHP script will run in the background after the form has been submitted, even if you exit a / c

I am doing a massive email project. Everything is going well, but the problem is that I have a form. After sending, I get a bulk email identifier from the database (about 3000 letters). I gave an interval of 3 seconds (using the sleep () method) for each letter. It takes about 9000 seconds. Users don't want to get stuck on one page until the php script completes.

How to run php script in background even after exiting widows platform? If the user logs in again, the indicator should be visible. Is it possible without using a Cron job?

I need a solution. Can someone help me solve this problem?

+4
source share
3 answers

To start the background process, we can use the wge't command, which has many options for use with the likes of (-r, -o, -p)

For your problem, you want to run a specific module / url in the background so that after it starts, it should continue to work in the background so that you can execute the command:

wget -o logfile linux.about.com &

You can learn more about wget below:

http://linux.about.com/od/commands/a/Example-Uses-Of-The-Command-Wget.htm

+4
source

You must maintain the queue and hold your request, and then the queue must be executed when running a Cron job in the background. The request should have a flag that can inform the user about cron completion or how many percent has been reached.

An email sender should not be launched from the Internet. Do this cron job.

+1
source

This is possible through the "CRON JOB". If you use cPanel, you can easily find it. For other hosting control panels, it is called "Time Schedule". You can google "How to configure cron".

0
source

Source: https://habr.com/ru/post/1415903/


All Articles