wordpress媒体上传内存大小问题

6gpjuf90  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(387)

我上传文件到wordpress系统有问题。如果我尝试上载大小约为80 kb的test.jpg文件,则会出现以下错误:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8388616 bytes) in /var/www/vhosts/*****/httpdocs/wp-includes/wp-db.php on line 1890

我试着把下面的代码放在wp-config.php中

define( 'WP_MAX_MEMORY_LIMIT' , '512M' );

但没有成功。
上传测试文件后,在服务器日志上出现以下错误:

AH01071: Got error 'PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /var/www/vhosts/*****/httpdocs/wp-includes/wp-db.php on line 1889\n', referer: https://*********/wp-admin/media-new.php

现在,我已经放置了另一个备份,因此我得到了另一个错误:

WordPress databasefout: [Duplicate entry '0' for key 'PRIMARY']
INSERT INTO `x9i8Z_icl_translations` (`element_type`, `language_code`, `trid`) VALUES ('post_attachment', 'nl', '7526')

Notice: Trying to get property of non-object in /var/www/vhosts/***********/httpdocs/wp-content/plugins/sitepress-multilingual-cms/classes/media/duplication/class-wpml-media-attachments-duplication.php on line 201

Notice: Trying to get property of non-object in /var/www/vhosts/***********/httpdocs/wp-content/plugins/sitepress-multilingual-cms/classes/media/duplication/class-wpml-media-attachments-duplication.php on line 201
0

这很奇怪,因为在旧版本上它工作得很好,但是如果我将所有数据库数据放在新模式上,它就不再工作了:(

0qx6xfy6

0qx6xfy61#

你需要设置 upload_max_size 通过 wp-config.php 文件。
@初始设置 ( 'upload_max_size' , '512M' ); 最好随上载大小增加最大执行时间。所以,最终输出将如下所示。

@ini_set( 'upload_max_size' , '512M' );
@ini_set( 'post_max_size', '512M');
@ini_set( 'max_execution_time', '2400' );

相关问题