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 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了