【问题标题】:Magento 1.9 cron job and PHP 7Magento 1.9 cron 作业和 PHP 7
【发布时间】:2016-04-05 10:43:47
【问题描述】:

我已经使用 PHP 7 安装了 Magento 1.9.2.2,并且我正在使用 cron 作业执行 shell 来导入产品并将订单导出到我的供应商。不幸的是,没有启动任何进程,我正在尝试找出问题所在。

cron 作业设置为 /usr/local/bin/php /home/"username"/domains/"mydomain"/public_html/cron.sh 并给出以下响应:

#
   # Magento
   #
   # NOTICE OF LICENSE
   #
   # This source file is subject to the Open Software License (OSL 3.0) # that is bundled with this package in the file LICENSE.txt.
   # It is also available through the world-wide-web at this URL:
   # x
   # If you did not receive a copy of the license and are unable to # obtain it through the world-wide-web, please send an email # to x so we can send you a copy immediately.
   #
   # DISCLAIMER
   #
   # Do not edit or add to this file if you wish to upgrade Magento to newer # versions in the future. If you wish to customize Magento for your # needs please refer to x for more information.
   #
   # @category    Mage
   # @package     Mage
   # @copyright  Copyright (c) 2006-2015 X.commerce, Inc. (x)
   # @license    x  Open Software License (OSL 3.0)
   #

   # location of the php binary
if [ ! "$1" = "" ] ; then
    CRONSCRIPT=$1
else
    CRONSCRIPT=cron.php
fi

MODE=""
if [ ! "$2" = "" ] ; then
    MODE=" $2"
fi

PHP_BIN=`which php`

   # absolute path to magento installation
INSTALLDIR=`echo $0 | sed 's/cron\.sh//g'`

   #    prepend the intallation path if not given an absolute path
if [ "$INSTALLDIR" != "" -a "`expr index $CRONSCRIPT /`" != "1" ];then
    if ! ps auxwww | grep "$INSTALLDIR$CRONSCRIPT$MODE" | grep -v grep 1>/dev/null 2>/dev/null ; then
        $PHP_BIN $INSTALLDIR$CRONSCRIPT$MODE &
    fi
else
    if  ! ps auxwww | grep "$CRONSCRIPT$MODE" | grep -v grep | grep -v cron.sh 1>/dev/null 2>/dev/null ; then
        $PHP_BIN $CRONSCRIPT$MODE &
    fi
fi

但如果我使用 /usr/local/bin/php /home/"username"/domains/"mydomain"/public_html/cron.php 它会给出以下响应:

PHP Fatal error:  Uncaught DivisionByZeroError: Modulo by zero in /home/"username"/domains/"mydomain"/public_html/app/code/core/Mage/Cron/Model/Schedule.php:165
Stack trace:
   #0 /home/"username"/domains/"mydomain"/public_html/app/code/core/Mage/Cron/Model/Schedule.php(95): Mage_Cron_Model_Schedule->matchCronExpression('*', 10)
   #1 /home/"username"/domains/"mydomain"/public_html/app/code/core/Mage/Cron/Model/Observer.php(193): Mage_Cron_Model_Schedule->trySchedule(1451563804)
   #2 /home/"username"/domains/"mydomain"/public_html/app/code/core/Mage/Cron/Model/Observer.php(138): Mage_Cron_Model_Observer->_generateJobs(Object(Mage_Core_Model_Config_Element), Array)
   #3 /home/"username"/domains/"mydomain"/public_html/app/code/core/Mage/Cron/Model/Observer.php(75): Mage_Cron_Model_Observer->generate()
       #4 /home/"username"/domains/"mydomain"/public_html/app/code/core/Mage/Core/Model/App.php(1357): Mage_Cron_Model_Observer->dispatch(Object(Varien_Event_Observer))
      #5 /home/"username"/domai in /home/"username"/domains/"mydomain"/public_html/app/code/core/Mage/Cron/Model/Schedule.php on line 165

cron 作业 (cron.sh) 是否正常工作,但是否存在由于 PHP 7 引起的冲突?我能做些什么来纠正这个问题?

【问题讨论】:

    标签: cron magento-1.9 php-7


    【解决方案1】:

    DivisionByZeroError 异常必须解决。

    在 PHP 7 之前,除以零会引发警告,您可以随意忽略它并允许在当前代码路径中继续执行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-05
      • 2011-08-18
      • 1970-01-01
      • 2014-09-10
      • 2012-03-21
      • 2023-03-22
      • 1970-01-01
      相关资源
      最近更新 更多