Changing Max File Size

Changing Max File Size

Posted by: fuzzyz
Posted on: 2008-08-07 20:04:00

I found the directions on changing max upload file size but still don't understand exactly what to do.

Part of the instructions are:

Type this into PUTTY
mkdir ~/[your website directory]/cgi-bin

What do I replace [your website directory] with in the above code if:

my main domain is:

thathappened.com

and the subdomain I want to upload larger files to is:

media.thathappened.com

I'm not grasping this. or do I replace it with /home/.kristen/(my user name)

Should it be in my root directory? which is what? I just don't know what [your website directory] means. When I shell into my account, I'm in a directory outside of both my main domain folder and all of my subdomains. If Im following the above instructions, would it be:

mkdir ~/cgi-bin (skipping the [your website directory] part)

since my domain and subdomains are all in separate folders?

I wish there was an easier way to increase max php upload file size.

There rest of the directions are:

2/ Create a script to retrieve the latest copy of php.cgi and php.ini
Make a file in ~/ called php-copy.sh containing the following, where 100M contains

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!

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!

Re: Changing Max File Size

Posted by: sdayman
Posted on: 2008-08-07 20:11:00

You'll have to do it in your subdomain since your subdomain is a separate website from your main domain.

mkdir ~/media.thathappened.com/cgi-bin



-Scott

Re: Changing Max File Size

Posted by: fuzzyz
Posted on: 2008-08-07 20:56:00

Thanks for the quick reply : )

I'll give it a go.

Re: Changing Max File Size

Posted by: fuzzyz
Posted on: 2008-08-07 21:50:00

Just a quick update. It worked. I successfully uploaded a 10+ mb file to test it.

Thanks again for the directory help. : )

Tags: php copycgi systemmax sizewebsite directoryfile uploadputtyroot directoryfilesizesubdomainssubdomainfoldersshell