PHP help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seeandsee
    Check SIG!
    • Mar 2006
    • 50945

    #1

    PHP help

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 35 bytes) in file.php on line 52
    How to fix this, was working fine, but now i get this error? Thanks!
    BUY MY SIG - 50$/Year

    Contact here
  • CurrentlySober
    Too lazy to wipe my ass
    • Aug 2002
    • 38944

    #2
    P.H.P = Pretty Hard Poo...

    Need Help?

    Take Stool Softener / Laxative

    Your Welcome

    /thread


    👁️ 👍️ 💩

    Comment

    • seeandsee
      Check SIG!
      • Mar 2006
      • 50945

      #3
      Originally posted by CurrentlySober
      P.H.P = Pretty Hard Poo...

      Need Help?

      Take Stool Softener / Laxative

      Your Welcome

      /thread
      BUY MY SIG - 50$/Year

      Contact here

      Comment

      • CurrentlySober
        Too lazy to wipe my ass
        • Aug 2002
        • 38944

        #4
        Originally posted by seeandsee
        i came..


        👁️ 👍️ 💩

        Comment

        • Harmon
          ( ͡ʘ╭͜ʖ╮͡ʘ)
          • Mar 2004
          • 20012

          #5
          This error message can spring up in a previously functional PHP script when the memory requirements exceed the default 8 MB limit. However, do not fret because this is an easy problem to overcome.


          To change the memory limit for one specific script, include a line such as this at the top of the script:

          Code:
          ini_set("memory_limit","12M");
          The 12M sets the limit to 12 megabytes (12582912 bytes). If this does not work, keep increasing the memory limit until your script fits or your server squeals for mercy.

          You can also make this a permanent change for all PHP scripts running on the server by adding a line such as this to the server?s php.ini file:

          Code:
          memory_limit = 12M
          Keep in mind that a huge memory limit is a poor substitute for good coding. A poorly written script may inefficiently squander memory which can cause severe problems for frequently executed scripts. However, some applications are run infrequently and require lots of memory like importing and processing a large data file.
          [email protected]

          Comment

          • notjoe
            Confirmed User
            • May 2002
            • 5599

            #6
            Originally posted by seeandsee
            How to fix this, was working fine, but now i get this error? Thanks!
            Your script is using too much memory. You can either write better code or increase the amount of ram that php is able to consume.

            Comment

            • raymor
              Confirmed User
              • Oct 2002
              • 3745

              #7
              You read the while damn file into memory instead of 1K at a time in a loop. If you DID loop, PHP read the whole damn file into memory anyway because while PHP 5 sucks far less than PHP 4, it still sucks awefully bad. Turn off output buffering.

              Because the script is called file.php, I bet the code is the same as every other script with that name. Actually there are two versions of it - one that takes a filename as it's argument, and one that takes a file ID, which is then looked up in a database. If you're passing a filename, a bad guy can pass ../.../cgi-bin/.htpasswd or whatever and get any file they want. Fix that, then fix better because your first try will still leave you vulnerable.
              Last edited by raymor; 07-16-2012, 04:12 AM.
              For historical display only. This information is not current:
              support@bettercgi.com ICQ 7208627
              Strongbox - The next generation in site security
              Throttlebox - The next generation in bandwidth control
              Clonebox - Backup and disaster recovery on steroids

              Comment

              • raymor
                Confirmed User
                • Oct 2002
                • 3745

                #8
                BTW the second thing Harmon said applies in this case. You do not want to increase the memory limit. If you're reading more than 36 MB into RAM at once, you're doing it wrong.
                For historical display only. This information is not current:
                support@bettercgi.com ICQ 7208627
                Strongbox - The next generation in site security
                Throttlebox - The next generation in bandwidth control
                Clonebox - Backup and disaster recovery on steroids

                Comment

                Working...