How to register a command so that the script runs every minute?

did so:

http://site.ru/script.php 

Time */1 * * * *

But nothing does. In the logs:

25 Oct 17:01:00 Start: http://site.ru/script.php

25 Oct 17:01:00 Start result: 0

I need to run the script on the site.

  • do you have to run the script through the web? Can't it run locally from the console or what? as it does not look normal - teran
  • well or rather this one - teran
  • but if you need to perform a query to a foreign site, the solution will be somewhat different, for example, using the PowerShell script . Or your pkhp script that accesses the specified URL - teran

1 answer 1

For your question there are two options for the development of events:

  1. You run the script on your server .
    In this case, you have access to the scripts directly, and there is no need to execute scripts via the http protocol. You just run it.
    The launch string will be: */1 * * * * php "d:\path\to\script.php"
    A little more look here .
  2. The script must be run on a remote server .
    That is, you need to contact a remote resource. In this case, you will need some intermediate tool that will perform a direct appeal. This can be done again using the php interpreter, or, for example, the powershell command. Since, presumably, php we already have that:
    */1 * * * * php "file_get_contents('http://site.ru/script.php')"