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

  • SEARCH
  • Home
  • 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 8949515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:14:11+00:00 2026-06-15T13:14:11+00:00

Hello fellow stakoverflowers, I’m having a problem with PHP/Apache. I have an application that

  • 0

Hello fellow stakoverflowers,

I’m having a problem with PHP/Apache. I have an application that allows the admin to upload 100Mb files. The uploading works well but I’m having problems with the downloading.

It works perfectly with smaller files (tested with a 50Mb file) but for some reason I can’t get the 100 Mb files.

Here’s my php code

$extension = 'zip'; //for testing

switch ($extension) {
  case "dwg": $contentType="image/vnd.dwg"; break;
  case "dxf": $contentType="image/vnd.dxf"; break;
  case "pdf": $contentType="application/pdf"; break;
  case "zip": $contentType="application/zip"; break; 
  case "png": $contentType="image/png"; break; 
  case "jpeg": $contentType="image/jpeg"; break; 
  case "jpg": $contentType="image/jpg"; break; 
  case "gif": $contentType="image/gif"; break; 
  default: 
    $contentType = '';
}

@header("Content-type: " . $contentType);
@header("Content-Disposition: attachment; filename=$filename");
@header("Cache-Control: no-cache, must-revalidate");
@header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // passed date

echo file_get_contents($url);

I’ve also tried other solutions I found on SO.

header('Content-Description: File Transfer');
header('Content-Transfer-Encoding: binary');
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-type: " . $contentType);
header("Content-Disposition: attachment; filename=\"".$filename."\"");
header("Content-Length: ".filesize($url));

echo self::url_get_contents(URL_PUBLIC . $url);

...

private function url_get_contents ($url) {
    if (!function_exists('curl_init')){ 
        die('CURL is not installed!');
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $output = curl_exec($ch);
    curl_close($ch);
        echo $output;
    return $output;
}

Or

$file_contents = fopen($url, "r");
echo $file_contents;
fclose($file_contents);

All solutions return the same thing. A file size of 0 Kb.
Like I said, smaller sized files works.

Also, when I test locally, the 100 Mb size files download correctly so my guess is that the problem comes from the server. I’ve changed the php.ini as follows

register_globals = Off
magic_quotes_gpc = Off
post_max_size = 128M
memory_limit = 256M
upload_max_filesize = 128M
max_execution_time = 120
expose_php = off
session.save_path = /tmp
mysqli.default_socket = /tmp/mysql5.sock
mysql.default_socket = /tmp/mysql5.sock

It’s probably a memory limit problem but not sure.

  • 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-06-15T13:14:12+00:00Added an answer on June 15, 2026 at 1:14 pm

    I had a similar problem before. My problem turned out to be the hosting provider. Once a script takes too long to execute, the hosting provider typically just shuts it off. I’ve had the same issues when trying to upload large sql scripts through phpMyAdmin.

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

Sidebar

Related Questions

hello fellow java developers. I'm having a bit of an issue here. I have
Hello fellow stackies, I'm developing a site and I have a small problem. It's
Hello fellow programmers. I have a SQL Server 2005 query that is taking a
Oh hello there, fellow SO members, I have a web service that returns XML
Hello fellow programmers, I have made a function that looks up the database if
Hello Fellow stackoverflowers, I´m stuck writing a piece of code. I have application with
Hello fellow StackOverflowers! I have some information in a database that I need pulled
Hello fellow earthlings, I have an image as my background that I created in
Hello Fellow C# and Windows phone developers, For my windows phone application, I have
Hello fellow computer people :) I have a shell script that I will use

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.