Nextcloud解决Occ命令报错PHP Fatal error, Allowed memory size of XXX bytes exhausted-下一朵云
图1 Nextcloud-Allowed memory size of XXX bytes exhausted

报错内容:

PHP Fatal error, Allowed memory size of XXX bytes exhausted

例如:

PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php on line 133

决办法:

1.修改php.ini的memory_limit=XXX设置

2.一般情况如果未生效,还是提示php的内存溢出,那么在config.php文件查找是否存在'memcache.local' => '\OC\Memcache\APCu',此行配置

<?php
$CONFIG = array (
  'instanceid' => '****',
  'datadirectory' => '/var/lib/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.0.18',
  'dbname' => 'nextcloud',
  'dbhost' => 'mysql.pi',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '****',
  'installed' => true,
  'maintenance' => false,
  'loglevel' => 0,
  'cron_log' => true,
  'maxZipInputSize' => 5145728000,
  'allowZipDownload' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'allow_local_remote_servers' => true,
  'trusted_domains' => 
  array (
    0 => 'nextcloud.****',
  ),

3.如果存在2中的配置,那么找到php的配置文件夹

/etc/php/8.0/cli/conf.d/20-apcu.ini 或 /etc/php.d(具体路径系统不同可能不同请自行查找)

Nextcloud解决Occ命令报错PHP Fatal error, Allowed memory size of XXX bytes exhausted-下一朵云
图2 找到PHP配置文件路径

新建apcu.ini文件

cat apcu.ini

写入以下内容


[apcu]
apc.enable_cli=1
Nextcloud解决Occ命令报错PHP Fatal error, Allowed memory size of XXX bytes exhausted-下一朵云
图3 apcu.ini文件内容

保存后,重新执行occ命令,即可解决报错!

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。