phpfile-upload

Why does ini_set() not override PHP settings?


I am trying to upload larger files so I set this in PHP code:

ini_set('upload_max_filesize', '1000M');
ini_set('post_max_size', '1100M');
ini_set('memory_limit', '1200M');

but $_POST and $_FILES are empty. But when I change php.ini settings it works. Why it doesn't change setting on the fly?


Solution

  • It's too late to have those settings changed after PHP has started.

    And even if you could change memory_limit (depends on server configuration), it would be too late again if you expect that big of an upload.

    See ini_set() and http://www.php.net/manual/en/ini.list.php for more info.