internal server error when download large file php

The HTTP 500 Error – Internal Server Error may also be caused by PHP scripts that exceed the memory limit of your website. How to Live Search using PHP MySQL and Ajax

Solution:

ini_set('memory_limit','2048M');

This will set it for just the script. You will still need to tell apache to allow that much for a php script.

For unlimited memory limit set -1 in memory_limit variable:

ini_set('memory_limit', '-1');

This will solve the Internal Server Error.

Leave a Reply