Nextcloud解决Occ命令报错PHP Fatal error, 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(具体路径系统不同可能不同请自行查找)

新建apcu.ini文件

cat apcu.ini

写入以下内容


[apcu]
apc.enable_cli=1

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

>>本文为下一朵云的原创文章,转载请附上原文出处链接及本声明
>>原文链接地址:Nextcloud解决Occ命令报错PHP Fatal error, Allowed memory size of XXX bytes exhausted

暂无评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注