Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

How to Run cron.php From the Command Line

Submitted by on April 27, 2011 – 5:10 amOne Comment

It is strongly recommended to run cron.php from the command line because by default cron is launched through the web-server which creates additional connections.


Solution

Change code in cron.php

/cron.php file should looks like:

<?php
$_SERVER[‘HTTP_HOST’] = ‘example.com';
$_SERVER[‘REMOTE_ADDR’] = ‘127.0.0.1’;
$_SERVER[‘REQUEST_METHOD’] = ‘GET';
chdir(‘/home/…/public_html’); //Путь к папке с cron.php в файловой системе
include_once ‘./includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
?>

Run cron from crontab

Check the path to PHP interpreter.  In the example below, we use /usr/local/bin:

/usr/local/bin/php /home/…/public_html/cron.php

One Comment »

  • […] Run the following PHP-code on a site:: <?php /* http://drupal.org/node/75781 Shows a list of nodes titles sorted out by their creation dates (the newest are on the top). The original snippet didn’t use the secure db_rewrite_sql() function. */ $list_no =10; $sql = "SELECT n.title, n.nid FROM {node} AS n WHERE n.status = 1 AND n.title NOT LIKE ’301%’ ORDER BY n.changed DESC LIMIT $list_no"; $result=db_query(db_rewrite_sql($sql)); while ($anode = db_fetch_object($result)) $links[] = l($anode->title, "node/". $anode->nid); return theme_item_list($links); ?> […]

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.