File upload limit

software development


I tried changing the php upload limit via an .htaccess file to no avail. Is there anyway to increase the 7MB upload limit without having to create my own PHP.ini? This is annoying. The htaccess should be allowed to work.


This forum has a search function, and that question must have been asked, and answered on this forum scores of times. :wink:

Yes. You can also compile your own PHP. Or use something other than PHP to do your uploading.

[quote] This is annoying. The htaccess should be allowed to work.
Everyone is entitled to their opinion; I’m glad this, and other PHP settings are not readily changable by any twit on a shared host that can’t be bothered to understand enough about how PHP resource usage affects others on a shared host. :wink:

That’s not talking about you, of course … as you know how to change it. I think it’s a minor inconvenience for those that know what they are doing - and those that don’t should not be allowed to casually change the resource allocations.



Compile my own PHP? Yeah, I think that would be about 400 times more complicated than just shelling into my php.ini, and then of course, being left out from future server upgrades.

And so you know, before I posted this, I searched the forum, and found no viable answer.

If there isn’t a simple solution, just say so, dont get all self-righteous about it.


Hey, you asked if there was another way, and I answered you telling you there were a couple of ways. I can’t be held responsible if you don’t like" the answer. :wink:

Well, I suppose searching can be “hard” … and one man’s “viable” answer is sometimes too cumbersome, inconvenient, or incomprehensible for another.

There are several solutions, and I shared two of them with you (and you already know of a third). You didn’t ask for a “simple” solution, just if there was another way; How am I suppose to know what you will find “simple”?

I apologize if I sounded “all self-righteous about it”. Mea Culpa! It does appear that there is no solution you will find “simple”. Good luck with your project! :wink:



I was able to accomplish increasing this through .htaccess it’s fairly simple. Though I only found out after I went through a whole ordeal through SSH and creating a custom php.ini etc.

In the directory where you want to change the file upload limit, create a file called .htaccess and then paste the following:
AddHandler application/x-httpd-php .php
php_value post_max_size 250M
php_value upload_max_filesize 250M

You can change 250M to whatever you’d like. PHP.ini didn’t work for me as the changes in the wiki increased the size, but the needed .htaccess contents disabled the login for my forums.

The above should work. |


Actually, no, that doesn’t work in my case, because that’s exactly what I started out doing. My guess is that whatever changes you made in your PHP.ini file allowed the limits to be modified via .htaccess past the original 7MB.

Thanks anyway


That only works if you are using mod_php, not the default PHP-CGI installed on DreamHost (that’s what your add-handler directive is doing).

Beware that, by doing it that way, you risk your site breaking at any time should DreamHost no longer make mod_php available to you:

Make sure you read the comments on that post for information about the “workaround” you are using,. so you understand the risks. :wink:



File uploads are awfully easy in Perl, but it seems a shame to load the huge Perl interpreter just to upload a file.

Why not exec an upload program written in C? You don’t have to write it from scratch. The CGIC library is extremely easy to use. Thomas Boutell wrote it and has been maintaining it for about 15 years, it’s highly unlikely to have any undiscovered bugs.

Unlike PHP, the C language and the CGIC library are highly stable, and you don’t have to worry about new versions brealing old code.