Skip to main content
Home
Blog

Main navigation

  • Home
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Knowledge Base
  4. How-To

How to fix cron.php fail with 404 error?

By ongetc , 26 February, 2017

The causes of cron.php fail with 404 error has a lot of theories but the one that I found work for me is "clear cached data". You might also get "Cron job fail" when to try to run manually!

Here is how to do "clear cached data":
. Click on "Administer", then click on "Performance" and scroll toward the bottom you will find "Clear Cached Data" button, click on it.

This will clear any previously log cron.php related error which might cause your cron.php to fail and return with 404 error. This will take care of the failure but what might cause it to be like that from time to time!

Since the cron.php is web accessible anyone can just try to run cron.php and give you a DoS which might cause cron.php to get into this situation so you need to secure your cron.php by way of .htaccess

Here is a sample code that you can use to add to your Drupal .htaccess to only allow running Drupal cron.php from your localhost and your IP.

Order Deny,Allow
Deny from all
Allow from localhost
Allow from 127.0.0.1
# Allow from xx.xx.xx.xx

In case you are looking for sample on how to run cron.php here are some samples:

curl http://yoursite.com/cron.php
wget http://yoursite.com/cron.php
lynx -source http://yoursite.com/cron.php
PHP -q /home/username/www/drupal/cron.php

Here is a sample what you would enter into crontab to send email and cron.php every two hours


crontab -e

MAILTO="youremail@mail.com"
*/120 * * * * wget http://yoursite.com/cron.php

Forums
How-To

Reseller hosting (free)

Hosting24 (w/ ssh)

A2 Hosting

Monthly archive

  • February 2019 (1)
  • December 2020 (224)
  • January 2021 (168)
  • March 2021 (1)

Pagination

  • Previous page
  • 2

Popular content

Last viewed:

  • JavaScript Lint
  • SAPID
  • MMBase
  • How to do URL masking?
  • htmldog.com
  • JavaScript DB
  • Fedora
  • ndCMS
  • Contenido
  • How to create blog in Drupal

User login

  • Reset your password