Search code examples
phplinuxcroncron-task

PHP Cronjob to run every minute not working


on 1and1 server/ linux i want to run a php file to redirect to a url every minute (using php header)

*/1 * * * * /usr/bin/php /kunden/homepages/XXXXXX/XXXXXX/htdocs/cron.php

i entered this command but not working...

file is exist and php code work fine, file path is correct. i searched many times to check my command is correct or not, but i'm sure command is ok.

in php file, it will redirect to a url, that url will save data to database. i checked every minute but looks like php file not redirected.


Solution

  • @Alipour, Please check below points for CRON Job.

    1. Check your file path is appropriate or not.

    2. If file path correct, then check file execute or not. (You can check file execution through send an test email or write output in to any text file).

    3. You need to create code of save your data in to that file itself,because CRON Job not provide such type of functionality that redirect to any other URL. Redirection of any other URL in cron won't be work.

    Let me know if you still have any questions.