لقد حاولت إصلاح مشكلة لبضعة أشهر حتى الآن ولكن لا يبدو أنني وصلت إلى أي مكان. لدي خبرة قليلة أو معدومة في PHP بالإضافة إلى القليل من معرفة Magento.
يعمل الموقع Magento الإصدار 1.9.2.4.
كرونتاب
SHELL="/bin/sh" */5 * * * * /bin/sh /var/www/vhosts/WEBSITE.com/httpdocs/cron.sh
لقد استخدمت plesk لتعيين كل من cron.php و cron.sh لتحويل نهايات الخط إلى UNIX. منذ القيام بذلك ، أتلقى العديد من رسائل البريد الإلكتروني التي تحتوي على أخطاء. يمكن لأي شخص لي نقطة في الاتجاه الصحيح؟
البريد الإلكتروني
/var/www/vhosts/WEBSITE.com/httpdocs/cron.php: line 1: ?php: No such file or
directory
/var/www/vhosts/WEBSITE.com/httpdocs/cron.php: line 2: /bin: Is a directory
/var/www/vhosts/WEBSITE.com/httpdocs/cron.php: line 3: conf: command not
found
/var/www/vhosts/WEBSITE.com/httpdocs/cron.php: line 4: conf: command not
found
/var/www/vhosts/WEBSITE.com/httpdocs/cron.php: line 5: conf: command not
found
/var/www/vhosts/WEBSITE.com/httpdocs/cron.php: line 6: conf: command not
found
/var/www/vhosts/WEBSITE.com/httpdocs/cron.php: line 7: syntax error near
unexpected token `('
/var/www/vhosts/WEBSITE.com/httpdocs/cron.php: line 7: ` * This source file
is subject to the Open Software License (OSL 3.0)'
قبل هذا البريد الإلكتروني ، كنت أتلقى أخطاء مختلفة عبر البريد الإلكتروني لـ cron.sh:
/var/www/vhosts/WEBSITE.com/httpdocs/cron.sh: line 48: syntax error near
unexpected token `fi'
/var/www/vhosts/WEBSITE.com/httpdocs/cron.sh: line 48: `fi'
كود - Cron.sh
#!/bin/sh
# @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
# @license http://opensource.org/licenses/osl-3.0.php 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
الرمز - Cron.php
<?php
/**
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
// Change current directory to the directory of current script
chdir(dirname(__FILE__));
require 'app/bootstrap.php';
require 'app/Mage.php';
if (!Mage::isInstalled()) {
echo "Application is not installed yet, please complete install wizard first.";
exit;
}
// Only for urls
// Don't remove this
$_SERVER['SCRIPT_NAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_NAME']);
$_SERVER['SCRIPT_FILENAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_FILENAME']);
Mage::app('admin')->setUseSessionInUrl(false);
umask(0);
$disabledFuncs = explode(',', ini_get('disable_functions'));
$isShellDisabled = is_array($disabledFuncs) ? in_array('shell_exec', $disabledFuncs) : true;
$isShellDisabled = true;
$isShellDisabled = (stripos(PHP_OS, 'win') === false) ? $isShellDisabled : true;
try {
if (stripos(PHP_OS, 'win') === false) {
$options = getopt('m::');
if (isset($options['m'])) {
if ($options['m'] == 'always') {
$cronMode = 'always';
} elseif ($options['m'] == 'default') {
$cronMode = 'default';
} else {
Mage::throwException('Unrecognized cron mode was defined');
}
} else if (!$isShellDisabled) {
$fileName = escapeshellarg(basename(__FILE__));
$cronPath = escapeshellarg(dirname(__FILE__) . '/cron.sh');
shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -mdefault 1 > /dev/null 2>&1 &"));
shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -malways 1 > /dev/null 2>&1 &"));
exit;
}
}
Mage::getConfig()->init()->loadEventObservers('crontab');
Mage::app()->addEventArea('crontab');
if ($isShellDisabled) {
Mage::dispatchEvent('always');
Mage::dispatchEvent('default');
} else {
Mage::dispatchEvent($cronMode);
}
} catch (Exception $e) {
Mage::printException($e);
exit(1);
}