Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7059779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:16:24+00:00 2026-05-28T04:16:24+00:00

After my hosting provider upgraded server (Debian) and PHP (from 5.2.6 to 5.3.2) I

  • 0

After my hosting provider upgraded server (Debian) and PHP (from 5.2.6 to 5.3.2) I am having problems with my file download script on our website. Files smaller then 100MB will download fine, but file larger then 100MB will download only as 156 Bytes file … Here is my download script:

class Download_Controller extends Website_Controller
{

    public function index()
    {
        if (isset($_GET['file'])) {
          $file     = $_GET['file'];
          $filORM   = ORM::factory('file')->where('filename', $file)->find();

          if ($filORM->loaded and $filORM->deleted=='N' and file_exists(APPPATH.'downloads/'.$file) ) {
            //we can serve file download
            $this->auto_render = false;

            $filORM->counter = $filORM->counter + 1;
            $filORM->save();

            $dl = ORM::factory('download');
            $dl->download_file_id = $filORM->id;
            $dl->created = time();
            $dl->country_id = $this->country->id;
            $dl->ip = $this->_getRealIpAddr();
            $dl->browser = Kohana::user_agent('browser');
            $dl->version = Kohana::user_agent('version');
            $dl->platform = Kohana::user_agent('platform');
            $dl->save();

            return download::force(APPPATH.'downloads/'.$file);
          }
          else {
            $this->download_error();
          }

        }
        else {
            //else here we load download center UI
            $this->section();
        }
    }   
}

I am using Kohana PHP framework. Version 2.3.x.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:16:24+00:00Added an answer on May 28, 2026 at 4:16 am

    In the comments, you gave me example links, I tried one, and that 156-byte file I downloaded contained this:

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 141637633 bytes) in /home/www-data/system/helpers/download.php on line 93

    It’s quite clear – PHP ran out of memory. I presume while upgrading they also changed the memory_limit in php.ini. Short-term solution is to change it back to it’s original (higher) value.

    For downloading large files, you should look into mod_xsendfile (also available for servers other than apache), that involves setting a special http header, and leaving the work to the webserver instead of php.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

after I define a kind of file format, it is dificult for hosting providers
I am transferring a database from one hosting provider to another. The current provider
Ok I just setup a dedicated server for my client through his hosting provider.
I am using crystal report for printing . But after hosting in the server
After trying to get the mercurial repository explorer setup on my shared hosting with
I have just deployed a new MVC3 app to my hosting provider for the
I decided to give a try to Magento. I have used my hosting provider´s
I have problem with connecting to Sql Server from my local machine. Seems like
I am using Network Solutions as a hosting provider with a UNIX hosting package.
I have a web application deployed in an internet hosting provider. This web application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.