Why does DH limit Gallery2 to 7MB uploads!?

I’m wondering why Dreamhost has chosen to limit
Gallery2 to 7 MB uploads?

I’m trying to use Gallery2 as a multimedia gallery for
movies - not just pictures. but the file size limit is killing me!

In order to increase the file size limit, you have to get
access to the PHP.ini file - something that DH doesn’t
allow, unless you compile your own version of PHP.

I’m not a programer or PHP wizard…and after a week of trying to compile a custom PHP with no sucess, i’m fed up.

i just want to use Gallery2 to view my movies. I can’t imagine I’m the only one…why can’t DH take this into consideration and up the default file size limit for their PHP???

is there some security or technical reason why?


I don’t know the exact reason for it, but it’s actually a lot higher than what I’ve seen at other hosts (2mb mostly).

Have you tried out the “From local server” or “From web page” options on the add item page after using FTP to upload? Other than compiling your own version of PHP those are the only options I can think of.

yeah, i tried upload from local server, but it didn’t work.
where should i place the directory to upload files from?
can it be anywhere in my home folder??

php.ini says so. Any uploader using php is going to be limited by this

In gallery I’ve found the “Windows XP” option for uploading to be the most convenient if you’re using XP, otherwise you might wanna try the “From local server” option as has been mentioned, or the java applet may work for you as well but you’ll have to install that one in the site admin area under “modules” - it’s called “remote” I believe


Looking at the php.ini file the upload file maxsize is 10M.

I have never tried this,or know if it has been tried before, but if you want to experiment…

Where ‘XX’ is the file size in MB.

I should add that I have not tried this because all my image files are tiny. :slight_smile:

My reply should have been made to the OP ‘anonymous’ not user919


This will not work here and there is no workaround. The upload limit through php is set at 7, and may be 8 or 10 depending on your domain’s configuration (php4, php5, pcgi etc)

don’t shoot the messenger =]


If you want to increase the filesize limit I think you’d have to compile php on your account so that you can alter the php.ini file.

It’s pretty straight-forward but I wasn’t able to make the install script dealie via ssh. I just made it in a text editor and uploaded it via ftp to my main directory and chmoded it to 775. Worked just fine once I ran the other commands.

The Insane Cabbit
Blog: http://www.sounanda.com
Store: http://www.marciesgifts.com
PM for CMS or forum install.
[color=#CC0000]$97 Off[/color] with promo code pixiedust

I have a fairly short workaround for this which will allow you to change the file size limit without having to compile your own php, and which will keep your php updated as dreamhost does updates. First you’ll need a cgi-bin directory:

mkdir ~/domain.com/cgi-bin/

Then make a file in ~ called php_update containing the following, where 100M contains whatever file size limit you like, and domain.com is appropriately substituted:



cp /usr/local/bin/php "$CGIFILE"
cp /etc/php/php.ini “$INIFILE”

perl -p -i -e ‘
s/.post_max_size./post_max_size = 100M/;
s/.upload_max_filesize./upload_max_filesize = 100M/;

Then do:

chmod +x php_update

If there are no errors, type:
crontab -e
And then enter the following in the text editor that shows up:

@weekly /home/myusername/php_update

This will update the php binary and config file once a week. Then go to the root of your site and make a .htaccess file which contains the lines:

AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

Good luck. :slight_smile:

The Veritas Society

I tried this… no errors while making it all
I put a .htaccess with the

AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

both in my root directory and the folder with my “files storage” for attachments to my website and I still get a limit

this is using the php4 method without creating my own php (as what I belive this suggested as a work around)

You must have gotten something not “quite right”, as this method does work. (I assume that you did create the appropriate update-php.sh script, place it in your “user’s root” directory, and run it :wink: ).

One thing I noticed, you said you put the described .htaccess in your “root” directory, and in the directory that stores the “files” for attachments, and there is where your problem might lie.

You need to put the .htaccess in your “site root” (per the instructions), which is not your (user’s) “root” directory. At Dreamhost, your “site root” generally takes the form of :


Note, this is different than your “user’s” root which takes the form of:


There is no need for the .htaccess file to be anywhere else.


hmmm well

my site when I login is like /mywebsitename/index.html etc etc

I tried .htaccess in the / directory and also in /mywebsitename

either way when I try to upload something like 8-10MB it just timesout and gives a error

is there a “timeout” or something also I need to change since it may take people up to like 20-30min to upload files.

unlike the example for 100M I set for 51M, thats about the only change I made. when I ran the php-update.sh and all I got no errors in the entire process, cronjob was setup and running.

you mentioned
/home/yourusername/yourdomain.tld <-- tld?

would /home/yourusername/ be hidden from the default login with webftp/ftpclient?

The only one you need the .htaccess in is the “/websitename”, as it is displayed in the Dreamhost webftp client. The actual “path” to that directory (which you would see via the shell) is “/home/yourusername/yourwebsitename.tld/”.

“Timing out” is an entirely different issue (though it could be related) than the upload failing because of a filesize limitation. PHP also has an execution time limit; if that is exceeded by the upload processing, there will be a failure because the process took too long to complete irrespective of the filesize. It is really important what “error” is “given”. We can’t really tell what is happening if you don’t share the details of the error :wink: .

Yes, there is. It is “adjusted” the same was as the other PHP settings. I, for one, will not participate in helping you set a “time limit” for up to “20-30” minutes on a shared server; if everyone did that it, an instance or two of a runaway, or abusive, script could quickly bring a shared server to its knees :wink:

“.tld” simply refers to your “top level domain” (.com, .org, .net, .uk, etc) It was just may way of saying “yourdomainname” while indicating that it has a “dot someting” at the end :wink:

That is the directory you are automagically placed into with Dreamhost’s webftp (it’s not hidden, but you won’t see it listed that way, because that is the directory you are “dumped into” when you login).

Have you checked yet whether your changes have taken effect by running phpinfo? Running this will tell you what your instance of PHP has for it settings, allowing you to see if your “instance” has been changed.


Ah, ok using phpinfo helped, I noticed for some reason my .htaccess was… altered when I uploaded it to something besides

AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

guess thats why it wasne’t working where I initially put it O_o

Thanks for the help!

Great! I’m glad you got it sorted out. That phpinfo.php file is a great help when things are “wonky” with php :wink: .


Ok, I’m not a total noob, but how to I remotly give commands to the server? I’ve made the dir, and uploaded the correct file to the correct location, and changed the chmod, but how do I execute the command and where can i use the commands you give me to execute?

You execute the commands in the Shell, using a SSH/telnet client.

Firstly, you must enable Shell access for the user you intend to log-in with. You do this in the panel at Users -> Manage Users, then click Edit on the relevant user and enable Shell access.

You can then use a SSH client (I use PuTTY) to log-in and execute the commands.

Below I have linked a wiki article which explains the steps you need to make to create / modify a localised PHP install.



Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )

awesome… now I won’t get any sleep tonight! ha, thanks for the help

ok, finished the instructions, now to test

ok, my server is down, what’d i do?
never mind, it was the .htaccess file, it was screwed up, i fixed it… thanks guys

How do I chmod + x? I don’t exactly get that part.