0

I'm trying to download a from into the server from a url, but the file is partially downloaded and I get a server error with no specific errors showing to debug.

The PHP code is as follows.

if (!isset($_GET['url'])){
    die('set file url');
}

if (empty($_GET['url'])){
    die('file url cannot be empty');
}

error_reporting(E_ALL);
ini_set('display_errors', 1);
set_time_limit(3600000);

$file_url       = $_GET['url'];
$ext_array      = explode('.', $file_url);
$extention      = end($ext_array);
$new_file_name  = "file".time().rand().".".$extention."";

file_put_contents($new_file_name, fopen($file_url, 'r'));

As on the code, I tried turning error reporting ON and also made a php.ini on the server but no errors are shown nor logged into an error log file.

Also I'm on shared hosting.

MORE INFO

The file i'm trying to download is about 1.5 Gigs, and only ~125MB is being downloaded before the error.

Relm
  • 7,923
  • 18
  • 66
  • 113
  • Did you change the the max file size allowed by the server? See this QA http://stackoverflow.com/questions/2184513/php-change-the-maximum-upload-file-size –  Mar 20 '16 at 16:33
  • @Terminus there's "upload_max_filesize" which is set to 2M and opcache.max_file_size set to zero. The upload fails at 125MB is already greater than these, do you think these might play a role in this? – Relm Mar 20 '16 at 16:44
  • Yes. Read the link. There are 2 directives that matter. Change those to atleaat 1.5GB. –  Mar 20 '16 at 16:49

0 Answers0