Launching a link via terminal or Cron

PHP scripts that require long-term work (one-time calculations or XML generation for marketplaces) can be run through the terminal or put into the Cron scheduler processing.

To do this, you need to know the path to php on your hosting. For example, if php is installed globally on a local machine, then the call will be simply "php", and in ukraine hosting the interpreter is at "/usr/local/php74/bin/php" (74 - version 7.4). 

Launching through the interpreter makes it possible to bypass the time limits for script processing.

Structure:

interpreter full path to the site root/index.php link, but space instead of slash

Example if the site is in /var/www/project.loc and you need to run the link http://project.loc/aggregator/service/google/file:

/usr/local/php74/bin/php /var/www/project.loc/index.php aggregator service google file

There is a second option for launching, via wget, but in this case there will be the same time limits as simply launching a link from a browser (30-60 sec).

An example of launching the same links http://project.loc/aggregator/service/google/file:

wget -t 1 -O - http://project.loc/aggregator/service/google/file

"wget" is a program installed in unix systems that allows you to download files by link.

"-t 1" is a parameter that the link is launched only once.

"-O -" is a parameter so that wget does not save the file to itself, but simply displays the contents of the response in the terminal.