filesize() [function.filesize]: stat failed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stan
    Junior Member
    • Jan 2011
    • 3

    filesize() [function.filesize]: stat failed

    I'm wondering what, in the server configuration has changed in recent months (Dathorn's cpanel55 server) which has impacted a long-ago-installed flatfile PHP image gallery script.

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 16000 bytes)

    filesize() [function.filesize]: stat failed for...


    The error occurs regardless of imagefile size, upon attempting to upload an image via the script... suggesting to me it's really a PERMISSIONS problem.
    -=-
    Actually, an imagefile is successfully uploaded, but the script doesn't seem to have permission to check its filesize and/or to move rename the newly uploaded imagefile.

    I haven't recently changed folder permissions.
    I haven't checked PHP safe_mode -- perhaps some change (now enforced server wide) is denying scripts access to the filesize() function?

    Must I now (since PHP version 5whatever has been installed and is more strict?) use some local php.ini setting, or some ini_set() command within the script, to preserve the earlier functionality of the script?
  • AndrewT
    Administrator
    • Mar 2004
    • 3653

    #2
    filesize() itself will work. The issue you need to be concerned with first is the fatal memory error. It is exceeding the 32MB limit. Try creating a file named php.ini with the following in it:

    memory_limit = 64MB

    Upload this file to the domain's public_html directory.

    Comment

    • stan
      Junior Member
      • Jan 2011
      • 3

      #3
      After placing the suggested php.ini in the domain's public_html directory, not even the index.php for the app would load. Instead, the memory error immediately displays.

      PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 16000 bytes)

      Prior to placement of the php.ini (and after removing it again) at least the php app would correctly display thumbs/images for the files already in place... the error didn't trigger until/unless I attempted to upload a new image. ANY image -- I tested with tiny 4Kb gifs.

      Yeah, the app uses GD, which is a memory hog.
      Yeah, the app is calling imagecreatetruecolor(), whereas it might consume fewer resources if just imagecreate() were used instead...

      ...but these points are moot. Nothing internal to the script has changed.
      I haven't messed with any php or other account setting of my hosting account.
      From my perspective, it. just. stopped. working.


      The script's upload function began throwing this error sometime last fall. I just didn't bother reporting it back then.

      Again, I ask: what has changed in the server configuration?

      When did things switch from Apache to LightSpeed ?

      I attempted to research the problem on my own, prior to posting here & worry the problem stems from some Lightspeed configuration detail:

      # uname -a Linux iwebtwo.danslereseau.com 2.6.18-194.26.1.el5xen #1 SMP Tue Nov 9 13:35:30 EST 2010 x86_64 x86_64 x86_64 GNU/Linux PHP (5.3.3) compiled using LSWS. # php -i | head phpinfo() PHP Version => 5.3.3 System => Linux iwebtwo.danslereseau.com 2.6.18-194.26.1.el5xen #1 SMP...


      Hi, on php.ini memory_limit is 64MB on litespeed i leave default directives about ram usage. One customer complain about this: Fatal error: Out of memory (allocated 18350080) (tried to allocate 30720 bytes) in /home/xxxxx/public_html/administrator/modules/mod_menu/helper.php on line...

      Comment

      • stan
        Junior Member
        • Jan 2011
        • 3

        #4
        phpinfo() indicates the memory limit is the stock 32Mb and max_upload_size is the stock 4Mb

        FWIW, this php gallery app which has worked fine on the dathhorn-hosted domain
        but its file upload function inexplicably stopped working is MG2 ( www.minigal.dk )

        One of the GD commands it utilizes is imagerotate()

        Tonight, after reading
        "the memory required to rotate an image is greater than the memory needed to create an image or crop it"


        as a troubleshooting step, I tried applying that transformation to one of the largest existing images in the gallery. As ever (and still with the stock 32Mb max memory php setting) that works fine.

        Comment

        • AndrewT
          Administrator
          • Mar 2004
          • 3653

          #5
          Nothing has really changed on the servers that would impact this. Those forum threads are also unrelated. LiteSpeed transitions began last March. Please submit a ticket with the complete details concerning your problem (domain, URLs, necessary login information, etc.) so that we can take a closer look. You should not have continued to receive that memory error at 32MB if you increased the limit to 64MB.

          Comment

          Working...