J
J
JaguXam2016-02-16 19:06:31
Task Schedulers
JaguXam, 2016-02-16 19:06:31

How to force a php script that is run by cron to be redirected?

Something I stuck not much.
It is required that the script that is launched by the
cron mypage.ru/cron.php
After the first 10 tasks are completed, it redirects to mypage.ru/cron.php?p=20
If I enter through the browser, then everything is fine. If I run it via cron, it doesn't work.
Are there any options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Matrozov, 2016-02-17
@Mear

1) You are probably doing a redirect through some kind of header('Location.... but it only works if you access the script through a browser, and do not execute it directly through cron.
2) Why do you even need this redirect when executing through cron? When executed from the console (from cron), there are (usually) no restrictions on the execution time of the script.

K
krypt3r, 2016-02-17
@krypt3r

You have absolutely no understanding of PHP CLI. A script for a browser and a console script for cron are two different things. There can be no redirects in the CLI script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question