dswqz24846 2011-05-26 13:57
浏览 18
已采纳

PHP致命错误:允许的内存大小耗尽。 怎么修?

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to
allocate 24 bytes)
in /home/fevsdiet/public_html/xxxxxxx.co.uk/booking/includes/functions.php
on line 481

What does this mean and how would one go about fixing it?

This is the code that is erroring:

   $availabilityArr = array();              
    #TODO - check if "to" is < "from" = means that "to" is +1 day.
    $st = date("Y-m-d H:i", strtotime($date." +".$tt[2]." minutes"));
    $et = date("Y-m-d H:i", strtotime($date." +".$tt[3]." minutes"));
    $a = $st;
    $n = 0; //layout counter
    $b = date("Y-m-d H:i", strtotime($a." +".$int." minutes")); //default value for B is start time.
    for( $a = $st ; $b <= $et ; $b = 
                       date("Y-m-d H:i", strtotime($a." +".$int." minutes")))
    {
        $availabilityArr[date("Y-m-d", strtotime($a))][] = date("H:i", strtotime($a));
        $a = $b;
        $n++;
    }
  • 写回答

6条回答 默认 最新

  • dongzhui9936 2011-05-26 14:09
    关注

    Basically, it means that PHP doesn't have any allowed memory left. This can be tweaked, using memory_limit clause, in your php.ini.

    If you are on a shared hosting, you might not be able to edit the php.ini. You still can try to use a .htaccess file :

    1. Create an file named .htaccess on the root of you web dir (usually /www or /web)
    2. Use the php_value clause :

      php_value memory_limit 128M #for example
      

    This is caused by some of your code, that try to use too many, or too big variables. Usually it's an infinite loop, or fetching a lot of data from a DB into one array,

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

报告相同问题?

悬赏问题

  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸
  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢