How to Run cron.php From the Command Line
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
[…] 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); ?> […]