Senin, 25 Mei 2009

Change Upload Max File Size Limit (Php.ini) on Dreamhost



After i successed change my “upload max file size limit” on dreamhost by modified the php.ini file, i want to share my experience with a complete and detail step-by-step for newbies, i know some people not understand through Dreamhost Wiki ( coz not really detailed, the instructions seems not for newbies like me). Well here you go, the detailed step-by-step How to change max file size for uploading from browser.



Ok! Here You go ( Detailed Step-by-Step )



1. First you need to know what PHP version do you use on your Dreamhost hosting.There Currenly only 2 version (PHP 4.xx or PHP 5.xx)



- login into your panel.dreamhost.com

- Choose “Domain“

- then choose “manage domain“

- select edit option on webhosting choice

- see your PHP version, the php shown is your php version



2. Second, you need to make a file and folder.



Make folder



- login to your ftp (via webftp or ftp)

- then go to your website folder, ex: lagoonware.com

- make new directory(folder), name it with ‘cgi-bin‘



Make file

- open your windows notepad

- and paste these code



If you use PHP4:



#!/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/php.cgi “$CGIFILE”

# REMOVE THE FOLLOWING LINE TO CREATE THE UPDATE-ONLY SCRIPT:

cp /etc/php/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”



——————————————————————————————–





If you use 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”





Continue…



- after that save the file as all file and name it ‘php-copy.sh’

- upload it in to cgi-bin folder that you made before

- Note : see the code, how in the code lines it is set to 100M, You can change this to whatever you want, I had it set to 500m.



3. Coding, You need to use SSH access ( i use free web based ssh client, www.browshershell.com )

- go to www.browshershell.com

- register, and log in

- after log in choose open shell

- Now READY to Coding.. ( :D )

- Note : These web based free ssh, feel so slow, and sometimes connection time out. so you need to restart.



4. Start Coding….

- after you start browshershell, you need to login to your server

- server: fill with -> yourusername@yourwebsite , ex: admin@lagoonware.com

- Port: fill with -> 22

- Login: fill with -> yourusername, ex: admin

- password : fill with -> your username password

- Note : These Username is like username do you use for ftp,webftp,etc.



5. After you success login

- type cd “yourwebsitedirectory“, then press enter. ex: cd lagoonware.com

- after that type: cd cgi-bin, then press enter

- type: chmod +x php-copy.sh ,then press enter

- type: dos2unix php-copy.sh, then press enter

- type: ./php-copy.sh

- leave the browshershell, but do not close it, we still need it





6. Make a .htaccess file

- open your windows notepad

- and paste these code



Options +ExecCGI

AddHandler php-cgi .php

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



- save it as all files, and name it with “.htaccess“

- upload the file into your website directory, ex: lagoonware.com folder

- note:sometimes you cannot save your file with ‘.htaccess‘ in windows, don’t worry just name it with ‘a.htaccess’. After you upload in to your website folder then rename it with ‘.htaccess‘



7. Back to browsershell

- type cp php-copy.sh php-update.sh

- Open the newly-created php-update.sh script in your favorite text editor (you can edit it using webftp) and DELETE these two lines:



# REMOVE THE FOLLOWING LINE TO CREATE THE UPDATE-ONLY SCRIPT:cp /etc/php/cgi/php.ini “$INIFILE”



- don’t forget to save it.

- in the browsershell 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





8. Congratulations,MISSION OBJECTIVES IS ACCOMPLISHED, you can upload BIG file now through browser.

- note: but you still cannot use dreamhost webftp, because net2ftp that dreamhost use restrict to upload for about 4Mb.

you can use another uploader, i use wordpress then i prefer to upload it using wordpress upload. There is so many free upload script do you can use. just google for it.

via

0 komentar: