Cron does not work and sends an error to the mail

Hi.

Please, help.

Cron must run the index.php script with the argv = 1 parameter ($ _SERVER [‘argv’] [1] == 1)
But it does not work, and sends a letter to the mail:

/home/user/web/site.com/public_html/index.php: 1: cannot open? php
: No such file
/home/user/web/site.com/public_html/index.php: 2: Syntax error: word unexpected (expecting “)”)

СRON user’s settings in the panel:
sudo /home/user/web/site.com/public_html/index.php 1

There is zero need to run the script with “sudo” in front, otherwise you would try to run it with root permissions.

About the argument, no idea - but you can use index.php?varname=value aswell

Thanks.

About the argument, no idea - but you can use index.php?varname=value aswell

/home/user/web/site.com/public_html/index.php?argv=1

$_GET parametrs?

Use

/usr/bin/php /home/user/web/site.com/public_html/index.php arg1 arg2 arg3

var_dump($argv);

Or use:

/usr/bin/wget https://site.com/index.php?var=test

To use with GET

Thank you very much! Everything is working.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.