Magento неправильно сообщает об ограничении памяти - PullRequest
0 голосов
/ 06 декабря 2018

У меня установлен Magento 2.3 в Windows 10 с использованием xampp.Я пытаюсь настроить свои задания cron, запустив

php bin\magento setup:cron:run

Я получаю сообщение об ошибке

setup-cron: Please check var/log/update.log for execution summary.

Когда я смотрю на update.log, я вижу следующие две ошибки

[2018-12-06 15:44:37] setup-cron.ERROR: Your current PHP memory limit is 2048M. Magento 2 requires it to be set to 756M or more. As a user with root privileges, edit your php.ini file to increase memory_limit. (The command php --ini tells you where it is located.) After that, restart your web server and try again. [] []
[2018-12-06 15:44:37] setup-cron.ERROR: Could not locate magento/magento2-base/composer.json file. [] []

Для первой ошибки, почему я получаю ошибку, даже если мой объем памяти превышает требуемыйлимит памяти?

Для второй ошибки, я должен сделать что-то для создания каталога magento2-base?У меня нет этого каталога в моем главном каталоге Magento (который называется magento23)?

Вот сокращенный вывод php -i, который содержит memory_limit

Core

PHP Version => 7.2.12

Directive => Local Value => Master Value
allow_url_fopen => On => On
allow_url_include => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
auto_append_file => no value => no value
auto_globals_jit => On => On
auto_prepend_file => no value => no value
browscap => C:\xampp\php\extras\browscap.ini => C:\xampp\php\extras\browscap.ini
default_charset => UTF-8 => UTF-8
default_mimetype => text/html => text/html
disable_classes => no value => no value
disable_functions => no value => no value
display_errors => STDOUT => STDOUT
display_startup_errors => On => On
doc_root => no value => no value
docref_ext => no value => no value
docref_root => no value => no value
enable_dl => Off => Off
enable_post_data_reading => On => On
error_append_string => no value => no value
error_log => C:\xampp\php\logs\php_error_log => C:\xampp\php\logs\php_error_log
error_prepend_string => no value => no value
error_reporting => 22527 => 22527
expose_php => On => On
extension_dir => C:\xampp\php\ext => C:\xampp\php\ext
file_uploads => On => On
hard_timeout => 2 => 2
highlight.comment => <font style="color: #FF8000">#FF8000</font> => <font style="color: #FF8000">#FF8000</font>
highlight.default => <font style="color: #0000BB">#0000BB</font> => <font style="color: #0000BB">#0000BB</font>
highlight.html => <font style="color: #000000">#000000</font> => <font style="color: #000000">#000000</font>
highlight.keyword => <font style="color: #007700">#007700</font> => <font style="color: #007700">#007700</font>
highlight.string => <font style="color: #DD0000">#DD0000</font> => <font style="color: #DD0000">#DD0000</font>
html_errors => Off => Off
ignore_repeated_errors => Off => Off
ignore_repeated_source => Off => Off
ignore_user_abort => Off => Off
implicit_flush => On => On
include_path => C:\xampp\php\PEAR => C:\xampp\php\PEAR
input_encoding => no value => no value
internal_encoding => no value => no value
log_errors => On => On
log_errors_max_len => 1024 => 1024
mail.add_x_header => Off => Off
mail.force_extra_parameters => no value => no value
mail.log => no value => no value
max_execution_time => 0 => 0
max_file_uploads => 20 => 20
max_input_nesting_level => 64 => 64
max_input_time => -1 => -1
max_input_vars => 1000 => 1000
memory_limit => 2048M => 2048M
open_basedir => no value => no value
output_buffering => 0 => 0
output_encoding => no value => no value
output_handler => no value => no value
post_max_size => 8M => 8M
precision => 14 => 14
realpath_cache_size => 4096K => 4096K
realpath_cache_ttl => 120 => 120
register_argc_argv => On => On
report_memleaks => On => On
report_zend_debug => Off => Off
request_order => GP => GP
sendmail_from => no value => no value
sendmail_path => no value => no value
serialize_precision => -1 => -1
short_open_tag => Off => Off
SMTP => localhost => localhost
smtp_port => 25 => 25
sys_temp_dir => no value => no value
track_errors => Off => Off
unserialize_callback_func => no value => no value
upload_max_filesize => 2M => 2M
upload_tmp_dir => C:\xampp\tmp => C:\xampp\tmp
user_dir => no value => no value
user_ini.cache_ttl => 300 => 300
user_ini.filename => .user.ini => .user.ini
variables_order => GPCS => GPCS
windows.show_crt_warning => Off => Off
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
zend.assertions => 1 => 1
zend.detect_unicode => On => On
zend.enable_gc => On => On
zend.multibyte => Off => Off
zend.script_encoding => no value => no value

1 Ответ

0 голосов
/ 06 декабря 2018

Это довольно странная ошибка.

Само сообщение об ошибке приходит отсюда

#File: setup/src/Magento/Setup/Model/PhpReadinessCheck.php
if ($currentMemoryInteger > 0
    && $this->dataSize->convertSizeToBytes($currentMemoryLimit)
    < $this->dataSize->convertSizeToBytes($minimumRequiredMemoryLimit)
) {
    $error = true;
    $message = sprintf(
        'Your current PHP memory limit is %s.
         Magento 2 requires it to be set to %s or more.
         As a user with root privileges, edit your php.ini file to increase memory_limit.
         (The command php --ini tells you where it is located.)
         After that, restart your web server and try again.',
        $currentMemoryLimit,
        $minimumRequiredMemoryLimit
    );
} elseif ($currentMemoryInteger > 0
    && $this->dataSize->convertSizeToBytes($currentMemoryLimit)
    < $this->dataSize->convertSizeToBytes($recommendedForUpgradeMemoryLimit)
) {
    $warning = true;
    $message = sprintf(
        'Your current PHP memory limit is %s.
         We recommend it to be set to %s or more to use Setup Wizard.
         As a user with root privileges, edit your php.ini file to increase memory_limit.
         (The command php --ini tells you where it is located.)
         After that, restart your web server and try again.',
        $currentMemoryLimit,
        $recommendedForUpgradeMemoryLimit
    );
}

с convertSizeToBytes живущим здесь

#File: vendor/magento/framework/Convert/DataSize.php
public function convertSizeToBytes($size)
{
    if (!is_numeric($size)) {
        $type = strtoupper(substr($size, -1));
        $size = (int)$size;

        switch ($type) {
            case 'K':
                $size *= 1024;
                break;

            case 'M':
                $size *= 1024 * 1024;
                break;

            case 'G':
                $size *= 1024 * 1024 * 1024;
                break;

            default:
                break;
        }
    }
    return (int)$size;
}

Моя лучшая / первая догадка, что - как-то - естьнекоторые дополнительные символы (пробелы, невидимые, не-ASCII числа) в вашем memory_limit значении, которые не очень подходят для логики этого метода.

Обновление: согласно комментариям - это целочисленное переполнение с помощью32-битная версия PHP.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...