dpvv37755 2014-04-27 18:42
浏览 92
已采纳

在WordPress中上传图像时内存不足

I am getting an 'out of memory' error message when I try to upload a file in WordPress. The file I'm trying to upload is an image ~1.6mb in file size and about 2500 x 2500 in dimensions. I'm using the Simple Local Avatars plugin to do the uploading. The plugin uses the WP function wp_handle_upload(). The specific error message I'm getting is:

Fatal error: Out of memory (allocated 84410368) (tried to allocate 9792 bytes) in wp-admin/includes/image-edit.php on line 339.

My aim is to pinpoint what exactly is 'out of memory'. Would this be my server out of memory? Or would this be the client? e.g. the user's browser? One thing I have noticed which might be important is that I can upload without problems if I use my laptop or iPad yet I always experience the error if I use my iPhone or my netbook.

I'd be grateful for any pointers you may have so that I can resolve the issue.

  • 写回答

2条回答 默认 最新

  • drtohng5613 2014-04-28 02:05
    关注

    One thing I have noticed which might be important is that I can upload without problems if I use my laptop or iPad yet I always experience the error if I use my iPhone or my netbook.

    That's really just a coincidence.

    But running out of memory when WordPress activates a plugin or you do a large image upload is fairly common.

    Try increasing the memory for PHP and Wordpress in several different ways:

    1) You can edit the memory_limit line in your php.ini (if you have access to that file) to increase memory to 64M:

    memory_limit = 64M;

    2) Try adding the "define" line below in your wp-config.php file a few lines of white space below the opening <?php in the file:

    define('WP_MEMORY_LIMIT', '64M');

    3) If those don't work, try adding this line at the top of your .htaccess file:

    php_value memory_limit 64M

    If that doesn't work or throws a "500 Internal Server Error", delete the line from .htaccess.

    If none of those work, your host probably doesn't allow memory allocation overrides. You're stuck with what they give.

    You can run phpinfo to see what kind of memory allocation you already have. Make a plain text file and call it phpinfo.php and put just this line in it:

    <?php phpinfo(); ?>

    then put the file in the root of your server, and then go to that file with your web browser. You'l see all the php info you need; scroll down for memory settings. If you get an error, that means your web hosting company won't allow phpinfo to run for security reasons.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题
  • ¥15 github训练的模型参数无法下载
  • ¥15 51单片机显示器问题
  • ¥20 关于#qt#的问题:Qt代码的移植问题
  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题