0

My cron file says: * * * * * root /usr/bin/php /var/www/html/cron.php

And cron.php is executable and located at /var/www/html/cron.php, still it doesn't work at all. My cron.php file:

<?php
include('Includes/top.php');

$Cron->closeServer();
?>
5
  • 2
    Why do you have "root" there? It should not be necessary to specify the username, this will attempt to execute the command root /usr/bin/php /var/www/html/cron.php Commented Jun 4, 2017 at 12:17
  • @rickdenhaan it doesn't work without either Commented Jun 4, 2017 at 12:24
  • We need more info here. On the face of it - $Cron isn't clearly defined. Commented Jun 4, 2017 at 12:29
  • @HPierce it works when I just visit that file in the browser, so that isn't the problem Commented Jun 4, 2017 at 12:33
  • i guess problem will be in php location /usr/bin/php, open terminal and run the command /usr/bin/php /var/www/html/cron.php do you see any error message ? Commented Jun 4, 2017 at 13:01

1 Answer 1

1

The problem is the include() is relative and you're probably not in the right working dir.

Change your command to cd /var/www/html && /usr/bin/php cron.php

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.