Increasing MAX FILE SIZE for dreamhost customers
Page: 1
WorldLightMedia
on Mar 24. 2007. 2:49 pm
For those who use Dreamhost, here is a handy guide to help you increase your maximum file upload size from the default standard 7mb.
I apologize for the crude format of this post... when I get more time I'll clean it up and make it easier to follow... for now these are basically my hastily scribed notes on this topic.
How to increase maximum file size: You'll need to setup your own PHP.ini
First verify php5:
click "edit" next to domain
Make sure the username associated with the domain has "shell" access
FTP user / CGI-runs-as user: Username here
Make a note of the username, machine, and password (available on edit page) (You'll need them later on, in Putty)
To change, click wrench icon (edit):
User Account Type: Shell account - allows FTP plus ssh/telnet access.
Click
"Save Changes"
Download & Install PUTTY (free online SSH program)
Follow the instructions at http://wiki.dreamhost.com/index.php/PHP.ini, use the following guide to go with the instructions:
Type this into PUTTY
mkdir ~/[your website directory]/cgi-bin
create a file called php-copy.sh and put it in your website directory
For PHP5:
#!/bin/sh
CGIFILE="$HOME/[your website directory]/cgi-bin/php.cgi"
INIFILE="$HOME/[your website directory]/cgi-bin/php.ini"
rsync -a /dh/cgi-system/php5.cgi "$CGIFILE"
# REMOVE THE FOLLOWING LINE TO CREATE THE UPDATE-ONLY SCRIPT:
cp /etc/php5/cgi/php.ini "$INIFILE"
perl -p -i -e '
s/.*post_max_size.*/post_max_size = 100M/;
s/.*upload_max_filesize.*/upload_max_filesize = 100M/;
' "$INIFILE"
Notice how in these lines it is set to 100M
You can change this to whatever you want, I had it set to 500m, and I successfully tested it with a 238MB file upload!
Where it says:
More general script with options:
ignore this section
In PUTTY, if you are using a subdomain to host your aC installation, type
cd [your website directory]
Then type:
chmod +x php-copy.sh
dos2unix php-copy.sh
./php-copy.sh
Create a file called .htaccess in your website directory:
Create the file ~/[your website directory]/.htaccess which contains the lines:
Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi
Type this into PUTTY
cp php-copy.sh php-update.sh
Open the newly-created php-update.sh script in your favorite text editor and DELETE these two lines:
# REMOVE THE FOLLOWING LINE TO CREATE THE UPDATE-ONLY SCRIPT:
cp /etc/php/cgi/php.ini "$INIFILE"
Then save php-update.sh
Type:
crontab -e
And then enter the following in the text editor that shows up (replacing 'myusername' with your specific username):
@weekly /home/[myusername]/php-update.sh
then hit CTRL-X, then ENTER
You are now ready to upload larger files!
I apologize for the crude format of this post... when I get more time I'll clean it up and make it easier to follow... for now these are basically my hastily scribed notes on this topic.
How to increase maximum file size: You'll need to setup your own PHP.ini
First verify php5:
click "edit" next to domain
Make sure the username associated with the domain has "shell" access
FTP user / CGI-runs-as user: Username here
Make a note of the username, machine, and password (available on edit page) (You'll need them later on, in Putty)
To change, click wrench icon (edit):
User Account Type: Shell account - allows FTP plus ssh/telnet access.
Click
"Save Changes"
Download & Install PUTTY (free online SSH program)
Follow the instructions at http://wiki.dreamhost.com/index.php/PHP.ini, use the following guide to go with the instructions:
Type this into PUTTY
mkdir ~/[your website directory]/cgi-bin
create a file called php-copy.sh and put it in your website directory
For PHP5:
#!/bin/sh
CGIFILE="$HOME/[your website directory]/cgi-bin/php.cgi"
INIFILE="$HOME/[your website directory]/cgi-bin/php.ini"
rsync -a /dh/cgi-system/php5.cgi "$CGIFILE"
# REMOVE THE FOLLOWING LINE TO CREATE THE UPDATE-ONLY SCRIPT:
cp /etc/php5/cgi/php.ini "$INIFILE"
perl -p -i -e '
s/.*post_max_size.*/post_max_size = 100M/;
s/.*upload_max_filesize.*/upload_max_filesize = 100M/;
' "$INIFILE"
Notice how in these lines it is set to 100M
You can change this to whatever you want, I had it set to 500m, and I successfully tested it with a 238MB file upload!
Where it says:
More general script with options:
ignore this section
In PUTTY, if you are using a subdomain to host your aC installation, type
cd [your website directory]
Then type:
chmod +x php-copy.sh
dos2unix php-copy.sh
./php-copy.sh
Create a file called .htaccess in your website directory:
Create the file ~/[your website directory]/.htaccess which contains the lines:
Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi
Type this into PUTTY
cp php-copy.sh php-update.sh
Open the newly-created php-update.sh script in your favorite text editor and DELETE these two lines:
# REMOVE THE FOLLOWING LINE TO CREATE THE UPDATE-ONLY SCRIPT:
cp /etc/php/cgi/php.ini "$INIFILE"
Then save php-update.sh
Type:
crontab -e
And then enter the following in the text editor that shows up (replacing 'myusername' with your specific username):
@weekly /home/[myusername]/php-update.sh
then hit CTRL-X, then ENTER
You are now ready to upload larger files!
you can use a .htaccess file on your folder:
AddHandler application/x-httpd-php .php
php_value post_max_size 150M
php_value upload_max_filesize 150M
php_value memory_limit 250M
AddHandler application/x-httpd-php .php
php_value post_max_size 150M
php_value upload_max_filesize 150M
php_value memory_limit 250M
hsurfer, are you sure the .htaccess method works for Dreamhost? I can't get it to work at least (though I've tried it with another upload script than the one that comes with activecollab)
guess I'm gonna have a closer look at the more lengthy solution...
guess I'm gonna have a closer look at the more lengthy solution...
the answers is "maybe"
the fact is after some tests, and the phpinfo() output i get my 150M post_max_size
BUT
all my scrips are broken now (pear, smarty and db_dataobjects) all is broken, receiving this output:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/.xxxx/xxx/lib/db/XXXX.php on line 12
Warning: Unknown(): open(/tmp/sess_h08usedvap5e1l7cn7vju3hc41, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
i guess the best option is follow the wiki
the fact is after some tests, and the phpinfo() output i get my 150M post_max_size
BUT
all my scrips are broken now (pear, smarty and db_dataobjects) all is broken, receiving this output:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/.xxxx/xxx/lib/db/XXXX.php on line 12
Warning: Unknown(): open(/tmp/sess_h08usedvap5e1l7cn7vju3hc41, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
i guess the best option is follow the wiki



