PHP script that runs on the server without a client request

I am working on a site for which the PHP script runs on the server without any request, this is a bot script that stores (not full time, but at least once a day) verification of customer accounts and sending warning messages to clients when that something is happening.

Any ideas are welcome.

+2
source share
6 answers

Assuming you need to do this on linux, you can run any php script from the browser and from the CLI.

You can run a simple php script:    <? echo "Ana are mere"; ?>

like this:    php -f ./index.php

, , , , , .

, , crontab (http://unixgeeks.org/security/newbie/unix/cron-1.html), .

- -

php PHP: script

, , exec() fsockopen() _get_contents() script, , , exec . http://us2.php.net/manual/en/function.session-write-close.php, "background script" "" http://us2.php.net/manual/en/function.ignore-user-abort.php

+8

cron, http://www.cronjobs.org/

script , . - , .

. www.yoursite.com/cronjob.php?key=randomstring

script, , script, .

+3

cron, , , , (, ?), .

, cron, .

+1

Evernoob Quamis, cron (UNIX/Linux/Mac OS) (MS Windows). , PHP script PHP (CLI), PHP, script. , wget ( ), PHP script, - URL- -.

+1

php script, . apache -.

while (1) script, apache/php script. , , ssh-, , , - cronjob.

, , .

+1

, , , , script URL- , , Selenium , . 100%, Selenium, , .

Something else you could try is to look at using the PHP process control functions ( link ). They will allow you to create a script that is deamon and runs in the background. You might be able to do this so that the script runs on the server and disables commands at programmed intervals. You still need some way to launch it for the first time (browser request or through the command line).

+1
source

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


All Articles