首页 文章

Magento 1.9 cron作业和PHP 7

提问于
浏览
0

我已经用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存在冲突吗?我该怎么做才能纠正这个问题?

1 回答

  • 3

    必须解决 DivisionByZeroError 异常 .

    在PHP 7之前,除以零会引发警告,您可以自由忽略该警告并允许在当前代码路径中继续执行 .

相关问题