Wordpress致命错误:允许的内存大小耗尽

时间:2011-08-06 05:16:10

标签: php wordpress memory phpmyadmin

我正在通过.CSV导入大量文件 - 所有这些似乎都很顺利但导入完成后我开始收到此错误:

在WordpPress帖子管理页面(http://localhost/wordpress/wp-admin/edit.php

( ! ) Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 524288 bytes) in C:\wamp\www\wordpress\wp-includes\class-wp-walker.php on line 176
Call Stack
#   Time    Memory  Function    Location
1   0.0016  857424  {main}( )   ..\edit.php:0
2   9.4654  31424712    WP_List_Table->display( )   ..\edit.php:249
3   9.4655  31425264    WP_List_Table->display_tablenav( )  ..\class-wp-list-table.php:709
4   9.4660  31425808    WP_Posts_List_Table->extra_tablenav( )  ..\class-wp-list-table.php:761
5   10.0549 31394480    wp_dropdown_categories( )   ..\class-wp-posts-list-table.php:222
6   16.4317 261790880   walk_category_dropdown_tree( )  ..\category-template.php:370
7   16.4441 266681480   call_user_func_array ( )    ..\category-template.php:763
8   16.4441 266682016   Walker->walk( ) ..\category-template.php:0
9   16.4441 266682064   func_get_args ( )   ..\class-wp-walker.php:176

并在导入CSV页面上(http://localhost/wordpress/wp-admin/tools.php?page = csv-importer / csv_importer.php)我得到了

( ! ) Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 63 bytes) in C:\wamp\www\wordpress\wp-includes\class-wp-walker.php on line 176
Call Stack
#   Time    Memory  Function    Location
1   0.0006  707784  {main}( )   ..\tools.php:0
2   0.0014  827336  require_once( 'C:\wamp\www\wordpress\wp-admin\admin.php' )  ..\tools.php:10
3   0.2692  30508160    do_action( )    ..\admin.php:151
4   0.2692  30509656    call_user_func_array ( )    ..\plugin.php:405
5   0.2692  30509688    CSVImporterPlugin->form( )  ..\plugin.php:0
6   0.2694  30510936    wp_dropdown_categories( )   ..\csv_importer.php:111
7   6.3437  260920048   walk_category_dropdown_tree( )  ..\category-template.php:370
8   6.3582  265810672   call_user_func_array ( )    ..\category-template.php:763
9   6.3582  265811208   Walker->walk( ) ..\category-template.php:0
10  6.3582  265811256   func_get_args ( )   ..\class-wp-walker.php:176

我一直在寻找最后几天试图解决这个问题 - 所有修复似乎都指向使用memory_limit修改php.ini(尝试-1和9999m)或使用define修改WP配置('WP_MEMORY_LIMIT', '64M');我回应了php信息,以确保发生的变化,似乎它们。如果有帮助的话,我在Windows 64x上运行WAMP。

所有帖子在前端显示都很好,它只是在后端,他们似乎产生了这个错误。老实说,我不知道下一步该尝试什么。欢迎任何想法!

3 个答案:

答案 0 :(得分:1)

某些网络服务器可能会施加内存限制。检查你的Apache设置,确保它不是罪魁祸首。

答案 1 :(得分:0)

尝试在csv_importer.php

的顶部设置此位代码
ini_set('memory_limit', '1024M');

答案 2 :(得分:0)

    Try these different settings in C:\wamp\bin\apache\apache2.2.6\bin\php.ini

    Find:
    post_max_size = 8M
    upload_max_filesize = 2M
    max_execution_time = 30
    max_input_time = 60
    memory_limit = 8M

    Change to:
    post_max_size = 750M
    upload_max_filesize = 750M
    max_execution_time = 5000
    max_input_time = 5000
    memory_limit = 1000M

    And add this to C:\wamp\bin\mysql\mysql5.0.45\my.ini:

    max_allowed_packet = 200M

    Then restart wamp