I have to be missing something. I CANNOT get my script to allow uploads larger than 2MB without changing the php.ini file. If I use

ini_set('memory_limit','64M');
ini_set('post_max_size','64M');
ini_set('upload_max_filesize','64M');

the only value that's changed is the memory limit. I've also tried using a .htaccess file, like so:

php_value upload_max_filesize 64M
php_value post_max_size 130M
php_value memory_limit 140M
php_value max_execution_time 300

If I do that, nothing changes, even after restarting Apache. Am I doing something wrong? This doesn't work on the host or on my personal testing server.

    You cannot set the upload_max_filesize within the script itself via ini_set(), as by that time it's too late. You have to either set it in the php.ini configuration if you have access/permission, or via a local .htaccess file if your PHP/web server configuration allows that.

      Am I doing it correctly in .htaccess my above post? It doesn't seem to be working. That's all that has to go in the .htaccess file, no other content, right?

        How was PHP integrated with Apache? ISAPI module or CGI binary? ([man]phpinfo/man tells you this at the top.)

        If the PHP interpreter is being invoked as a CGI binary, then you can't use the .htaccess method of altering PHP directives (man page: [man]configuration.changes[/man]).

          Well, on my personal server it is definitely installed as a module, and I think so on the host - The only line in phpinfo() I can find about it is "Server API: Apache 2.0 Handler".

            Write a Reply...