A
A
Andrew_ST2020-04-27 11:07:27
PHP
Andrew_ST, 2020-04-27 11:07:27

Setting up CRON when running a script with authorization?

Good afternoon!
I can't solve this problem. There is a script that is in the public part of the site. You need to run it as a scheduler once a month.

The folder where the script is located has Apache authorization, so the script is not executed.

If you move the script above - wget does not work.

What is the best way to do it in this case?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2020-04-27
@melkij

Take a step back and ask yourself: why do you need wget, http and Apache for cron at all?
Call the script itself from the console.

T
twobomb, 2020-04-27
@twobomb

Try with curl

0 0 1 * * user /usr/bin/curl -s http://site.com/script.php >/dev/null 2>&1

or
call the script through the interpreter
0 0 1 * *  /usr/bin/php /var/www/site/script.php >/dev/null 2>&1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question