duanlingzei0170 2014-07-19 17:50
浏览 58

magento cron job和error_log文件太大了

I installed Magento community edition recently and didn't do any intensive work on it with the exception of some design work and installation of a few extensions. I took a look at the error_log file today and it seems to be 6gb and almost maxing out my space for hosting. I thought this was unusual as the rest of the installation is less than 2gb so I opened the error log file (a portion of it, mind you, since its too large) and this comes up:

[12-Mar-2014 20:31:33 UTC] PHP Notice: Undefined index: SCRIPT_NAME in /home/zongulsz/public_html/cron.php on line 39

[12-Mar-2014 20:31:33 UTC] PHP Notice: Undefined index: SCRIPT_FILENAME in /home/zongulsz/public_html/cron.php on line 40

[08-Apr-2014 10:13:22 America/Chicago] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/alt/php53/usr/lib64/php/modules/memcached.so' - libmemcached.so.11: cannot open shared object file: No such file or directory in Unknown on line 0

Its the same entry over and over and over.

This is the cron job command I see in my cpanel:

Minute Hour Day Month Weekday Command Actions
13,29,31,49 * * * * php> /home/zongulsz/public_html/cron.php > /dev/null

And this is the cron.php file:

1   <?php
2   /**
3    * Magento
4    *
5    * NOTICE OF LICENSE
6    *
7    * This source file is subject to the Open Software License (OSL 3.0)
8    * that is bundled with this package in the file LICENSE.txt.
9    * It is also available through the world-wide-web at this URL:
10   * http://opensource.org/licenses/osl-3.0.php
11   * If you did not receive a copy of the license and are unable to
12   * obtain it through the world-wide-web, please send an email
13   * to license@magentocommerce.com so we can send you a copy immediately.
14   *
15   * DISCLAIMER
16   *
17   * Do not edit or add to this file if you wish to upgrade Magento to newer
18   * versions in the future. If you wish to customize Magento for your
19   * needs please refer to http://www.magentocommerce.com for more information.
20   *
21   * @category   Mage
22   * @package    Mage
23   * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24   * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
25   */
26
27  // Change current directory to the directory of current script
28  chdir(dirname(__FILE__));
29
30  require 'app/Mage.php';
31
32  if (!Mage::isInstalled()) {
33      echo "Application is not installed yet, please complete install wizard first.";
34      exit;
35  }
36
37  // Only for urls
38  // Don't remove this
39  $_SERVER['SCRIPT_NAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_NAME']);
40  $_SERVER['SCRIPT_FILENAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_FILENAME']);
41
42  Mage::app('admin')->setUseSessionInUrl(false);
43
44  umask(0);
45
46  $disabledFuncs = explode(',', ini_get('disable_functions'));
47  $isShellDisabled = is_array($disabledFuncs) ? in_array('shell_exec', $disabledFuncs) : true;
48  $isShellDisabled = (stripos(PHP_OS, 'win') === false) ? $isShellDisabled : true;
49
50  try {
51      if (stripos(PHP_OS, 'win') === false) {
52          $options = getopt('m::');
53          if (isset($options['m'])) {
54              if ($options['m'] == 'always') {
55                  $cronMode = 'always';
56              } elseif ($options['m'] == 'default') {
57                  $cronMode = 'default';
58              } else {
59                  Mage::throwException('Unrecognized cron mode was defined');
60              }
61          } else if (!$isShellDisabled) {
62              $fileName = basename(__FILE__);
63              $baseDir = dirname(__FILE__);
64              shell_exec("/bin/sh $baseDir/cron.sh $fileName -mdefault 1 > /dev/null 2>&1 &");
65              shell_exec("/bin/sh $baseDir/cron.sh $fileName -malways 1 > /dev/null 2>&1 &");
66              exit;
67          }
68      }
69
70      Mage::getConfig()->init()->loadEventObservers('crontab');
71      Mage::app()->addEventArea('crontab');
72      if ($isShellDisabled) {
73          Mage::dispatchEvent('always');
74          Mage::dispatchEvent('default');
75      } else {
76          Mage::dispatchEvent($cronMode);
77      }
78  } catch (Exception $e) {
79      Mage::printException($e);
80      exit(1);
81  }
82
  • 写回答

2条回答 默认 最新

  • duanbichou4942 2014-07-19 18:34
    关注

    Try putting ini_set('display_errors',0); and error_reporting(0); at the beginning of your cron.php file.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog