Getting Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 4864 bytes)

Posted on 2008-11-10
Last Modified: 2012-05-05
Getting an error message as Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 4864 bytes)
Question by:Suhashk
    LVL 6

    Accepted Solution

    This is due to the php.ini file. It's the maximum limit set by your PHP configuration.

    Try adding the following line to your script:
    ini_set('memory_limit', -1);

    If that doesn't work, you'll need to change the php.ini which could be tricky if you're on shared hosting.
    LVL 15

    Assisted Solution

    in your php script, you may temporarily need to set the memory limit via code, such as at the top of your php file, use this code below... However I'd highly recommend finding what part(s) of your code consumes all the memory and explore ways to fix it.


    Open in new window


    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Join & Write a Comment

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now