Cron Job - Not working

-1
<?php
include $_SERVER['DOCUMENT_ROOT'].'/aaa/core/database/connect.php';
include $_SERVER['DOCUMENT_ROOT'].'/aaa/functions/general.php';
include $_SERVER['DOCUMENT_ROOT'].'/aaa/functions/users.php';

$sql = $conn->query("SELECT 'user_id' FROM 'users'") or die(mysqli_error($conn));
    while ($row = $sql->fetch_assoc()) {
        $user_id = $row['user_id'];
        $inc_per_min = income_per_minute($user_id);

        if ($inc_per_min > 0) {
            $conn->query("UPDATE 'game_data' SET 'money_hand' = 'money_hand' + '$inc_per_min' WHERE 'user_id' = '$user_id'") or die(mysqli_error($conn));
        }
    }
?>

This is the code I want to run every minute. this is what I have in command of cron:

Current Cron Jobs
Minuto  Hora    Dia Mês Dia útil    Comando Ações
*   *   *   *   *   /home/MyUserName/public_html/aaa/cron_stack.php

Can anyone tell me why it does not work?

    
asked by anonymous 01.02.2016 / 19:46

2 answers

1

You need to put the cron command as you would run it on the command line.

If the executable is a PHP script, so you would run it like this:

php /home/MyUserName/public_html/aaa/cron_stack.php

So, in cron , it would look like this:

*   *   *   *   *   php /home/MyUserName/public_html/aaa/cron_stack.php
    
01.02.2016 / 21:00
-1

curl -s -o / dev / null link

It was just that ... Thanks APS for the answer in the thread: How to run cron job on server

    
01.02.2016 / 19:57