why does DH limit Gallery2 to 7MB uploads!!?

why does DH limit Gallery2 to 7MB uploads!!?

Posted by: Anonymous
Posted on: 2006-03-21 12:13:00

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?

thanks,
steve

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: daisygirl
Posted on: 2006-03-21 12:19:00

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.

Edited by daisygirl on 03/21/06 12:22 PM (server time).

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: scucolo
Posted on: 2006-03-21 12:23:00

In reply to:


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? The only other way I know of is to compile your own version of PHP.


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??


Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: ardco
Posted on: 2006-03-21 13:02:00

> is there some security or technical reason why?

G66gle says these pages in kba-wiki have relevant info.

Cheers,

BobS

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: user919
Posted on: 2006-03-21 14:27:00

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

jason

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: norm1037
Posted on: 2006-03-21 15:11:00

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...

In reply to:


Why can't I upload big files (over a megabyte or two)?

The upload limits are enforced by the PHP / webserver configuration and not by Gallery 2.

In short: The administrator can change the upload_max_filesize and post_max_size directives in php.ini (the PHP configuration file). Also, you can try to override the system-wide default settings in a .htaccess file. Example, add this to your .htaccess file in your gallery2/ folder to set a upload limit of 10 Mega Byte:

php_value post_max_size XXM
php_value upload_max_filesize XXM

This can result in a "Internal Server Error" (error status 500) on all your Gallery pages. If you get an error after this change, remove your changes. That means that your webhost doesn't allow such changes in .htaccess.

An alternative that works for some users: Add a php.ini file in your gallery2/ folder with the following contents (notice the difference, here we have a = and no php_value):

post_max_size = XXM
upload_max_filesize = XXM

This may or may not work. You can check if these changes have actually changed your limits by browsing to your add items -> from browser page.


Where 'XX' is the file size in MB.


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


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

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: user919
Posted on: 2006-03-21 15:16:00

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 =]

jason

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: Ryo-ohki
Posted on: 2006-03-21 15:29:00

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.
$97 Off with promo code pixiedust

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: kobok
Posted on: 2006-05-27 01:52:00

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:

In reply to:

#/bin/sh

CGIFILE="$HOME/domain.com/cgi-bin/php.cgi"
INIFILE="$HOME/domain.com/cgi-bin/php.ini"

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/;
' "$INIFILE"



Then do:

chmod +x php_update
./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. :)

The Veritas Society

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: gulkeeva
Posted on: 2006-09-26 01:22:00

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)

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: rlparker
Posted on: 2006-09-28 00:44:00

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 :

/home/yourusername/yourdomain.tld

Note, this is different than your "user's" root which takes the form of:

/home/yourusername

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

--rlparker

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: gulkeeva
Posted on: 2006-09-28 09:09:00

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?

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: rlparker
Posted on: 2006-09-28 09:34:00

In reply to:

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


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/".

In reply to:

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


"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.

In reply to:

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


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

In reply to:

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


".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

In reply to:

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


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.

--rlparker

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: gulkeeva
Posted on: 2006-09-28 11:25:00

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!

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: rlparker
Posted on: 2006-09-28 11:34:00

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

--rlparker

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: branndon
Posted on: 2006-10-09 17:26:00

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?

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: Raz2133
Posted on: 2006-10-09 20:47:00

In reply to:

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.

http://www.wiki.dreamhost.com/index.php/PHP.ini

Mark

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: branndon
Posted on: 2006-10-09 21:17:00

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

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: branndon
Posted on: 2006-10-09 21:31:00

ok, finished the instructions, now to test

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: branndon
Posted on: 2006-10-09 21:34:00

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

Edited by branndon on 10/09/06 09:37 PM (server time).

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: Mike Peluso
Posted on: 2006-12-10 17:06:00

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

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: anonymous2
Posted on: 2006-12-10 17:12:00

Look for chmod and ssh in wiki.dreamhost.com

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: mbwarn
Posted on: 2007-01-09 13:24:00

Hey folks.

I've followed the instructions exactly, creating an .htaccess file in my home directory to direct apache to use my local copy of php. This results in a weird 404 error, though:

The requested URL /home/[username]/cgi-bin/php.cgi/index.php was not found on this server.

It seems like it's doing some kind of weird URI_rewrite thing here. My .htaccess contains:

Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

Can somebody give me a clue what's going on here? Thanks!

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: Raz2133
Posted on: 2007-01-09 17:32:00

In reply to:

Can somebody give me a clue what's going on here?


log in via FTP or SSH and confirm that your domain directory contains a cgi-bin/ directory and that this directory contains the files php.cgi and php.ini

Mark

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: jeanmichel
Posted on: 2007-10-01 08:19:00

Hi,

now i know the post is a bit old but i've followed it anyway without any problem.

Xcept for those 2 lines added to my .htaccess file

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

Seems like i've lost all references to my linked css files.
It adds "cgi-php/" in front of all of my paths. That's not what i want.

What could be the problem?

jeanmichel

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: rlparker
Posted on: 2007-10-01 11:24:00

It would help, in this case, if you would provide a url so that we can view the related code. wink

--rlparker

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: jeanmichel
Posted on: 2007-10-01 12:42:00

Well, the url is
http://www.peterhannan.ca

To keep the site's paths right, i need to comment out those 2 lines of code in my .htaccess file:

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

Otherwise, there is no style applied to the site.

Now, for that purpose, i just uncommented those 2 lines so that there is no style.

jeanmichel

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: rlparker
Posted on: 2007-10-01 13:00:00

From looking at your source code it seems to me that the path for your "@imports" is derived from an environment variable.

As php-cgi produces "different" values in these variables, using the path of the php-cgi executable in places where you might expect the path of the script itself, it seems that when you change the path to the php-cgi executable your code is going to break as it is somehow deriving part of it's @import path information from that.

This would explain why the css is not being loaded even though you have only changed the handler (the css is not at the location where the script is looking for it.)

To test this, temporarily modify your php code to load the css with an absoulte or relative url that is not derived from an environment variable. In the simplest case, simply hard-code it in, and see that it then works correctly.

If it does (and I think it will), then you just need to modify the php code that calls the css (in your template, maybe?) to use an environment variable that produces the expected result, or code in the path(s) directly.

Does that make sense?

--rlparker

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: jeanmichel
Posted on: 2007-10-01 13:26:00

Thanks, it makes full sense.

But the thing is that i've installed drupal (its a popular cms).

So all of my paths are derived from php defines or env. var.
Everywhere where drupal is calling a path from a define var, it will load the php-cgi/ in front of the path.

My main goal is to be able to let the user post files bigger than 4mb without having to modify the php.ini file on dreamhost (they wouldnt let me anyway...)
so i've found that script
http://discussion.dreamhost.com/showthreaded.pl?Cat=&Board=3rdparty&Number=47220&page=&view=&sb=&o=&vc=1#Post47220
to help me do that.

The result is the path problem that i have to solve here...

have to dig deeper...

jeanmichel

Re: why does DH limit Gallery2 to 7MB uploads!!?

Posted by: rlparker
Posted on: 2007-10-01 13:39:00

Drupal! Yep.. this is a common problem with Drupal; many DH users have this trouble.

Check the Drupal forums (search for DreamHost) and you will find considerable discussion, and several fixes that should solve your issue.

Some are successful by simply uncommenting an "optional" base path setting in the Drupal configuration file (IIRC), though you certianly could also change the env variable in use to one that produced the "expected" result.

php.dreamhosters.com lets you look at both a php-cgi and a mod_php phpinfo() output, to help you identify which env variable will do what you want. wink

--rlparker



Tags: dreamhostini fileuploadsmoviesfedimaginedefaultsize limit