Reputation: 222879
I know that this question was asked many times, but most of the answers are not really useful.
So I edited crontab with crontab -e
. It was empty and I added just one line
*/1 * * * * php5 /var/www/cron.php
which I think will be executing cron.php every 1 minute. I saved the file, but it clearly is not executed (inside my php file I have only
<?
$file = 'test.txt';
file_put_contents($file, "Work");
and it is not created. I looked and modified permissions on cron.php to 777. Php is installed as apache module.
What bothers me is that when I do php5 /var/www/cron.php
from command line, I just see the content of the file and it not executed.
What am I doing wrong?
I also tried using full path with */1 * * * * /usr/bin/php5 /var/www/cron.php
but also with no luck.
Upvotes: 0
Views: 162
Reputation: 139
<?php
instead of <?
Upvotes: 0
Reputation: 782295
The first line of the script should be:
<?php
You may have short tags enabled in the Apache PHP configuration, but not the CLI PHP configuration.
Upvotes: 4