我在将文件上传到wordpress系统时遇到问题。 如果我尝试上传大小为arround 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
这很奇怪,因为在旧版本上它可以正常工作,但是如果我将所有数据库数据放在新的架构上,它将不再起作用:(
答案 0 :(得分:0)
您需要通过upload_max_size
文件设置wp-config.php
。
@ini_set ( 'upload_max_size' , '512M' );
最好通过上传大小来增加最大执行时间。因此,您的最终输出将如下所示。
@ini_set( 'upload_max_size' , '512M' );
@ini_set( 'post_max_size', '512M');
@ini_set( 'max_execution_time', '2400' );