I created a Drupal site for a customer on 1and1 hosting and never ran into so many problems. Finally got the site to show its face and do its thing ... and now can't get cron to work. 1and1 alternates between trying to help but not understanding the question (let alone the answer) ... and refusing to help at all.

I can run cron.php in the browser perfectly fine, and Drupal logs that it has run. When the cron job fires on a schedule, though, the server can't seem to figure out what to do with the code inside cron.php. It sends me an email full of errors that suggest it's not even recognizing cron as a PHP file:

/htdocs/cron.php: line 1: ?php: No such file or directory
/htdocs/cron.php: line 2: include_once: command not found
/htdocs/cron.php: line 3: syntax error near unexpected token `DRUPAL_BOOTSTRAP_FULL'
/htdocs/cron.php: line 3: `drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);'

When 1and1 was still trying to help, they created their own crontest.php file to prove the server was capable of running one, and that the error must be on our end. To test their file, they - you guessed it - opened it in a browser. No errors, so hey - it must work. Then they created a scheduled job for it .... and five minutes later, I got an email full of errors about *their* cron file.

To get this site to work at all I had to do many things ... one of which was to alter .htaccess to use PHP 5. I'm suspicious that this may only be applying to browsers, not server pings ...? I don't know enough about server admin to guess.

Anyone ever gotten cron.php to run as a scheduled job on 1and1?

Comments

vm’s picture

moved to hosting support forum as this seems host specific.

what command are you using to access from cronjob?

m.e.’s picture

Well, of course the host claims it is nothing to do with them. :)

I created a cronjob.txt file with this command: 30 * * * * /directorypath/cron.php (then a blank line)

Then via SSH I entered: 'crontab cronjob.txt'

The job fires and finds the file, but can't parse it.

I just tried something as a test: I entered 'php -q cron.php' from the command line. Oddly, it ends up displaying a lot of lines that look very much like the 'site offline' page ... a bunch of header and then

<p>The site is currently not available due to technical problems.....</p>

and so on. The site is definitely up and nothing like this displays in the browser window when cron.php is run there.