Modify PHP Upload Limit


#1

Hi,

I want to increase the PHP upload limit for my site (www.fotobucks.com) and I have found a tutorial on wiki dreamhost (http://wiki.dreamhost.com/PHP.ini). Here I want to ask, what are the risk of modification if modification failed? Will it cost data lost?

I am new to this and it also is my first time doing it. I tried to do the modification using putty.exe. After I run the putty.exe, I keyed in ‘fotobucks.com’ at the host name field and set to port 80. When I clicked on open button, putty open a new window with black color in it. The problem is that I cannot type and do anything with that window. What should I do in order to proceed?

From what I read from the tutorial (although I am not fully understand it), here I want to ask:

  1. Is it possible to do the modification by uploading all those files needed without using putty.exe?
  2. Where and how can I get the dreamhost original php.ini? So that later I can change the setting to increase the upload limit.

I will be very appreciate if you can provide detail steps by steps in the way to do the modification. Thanks.


#2

The worst that will happen is that your site stops working. In which case you just delete those lines, or the entire file, in .htaccess.

For Putty, the port shouldn’t be 80. Leaving it blank should work, but you can also try 22 which is default for SSH. You also need to go to the panel here and Edit your User to allow for Shell access.

If you want to do everything at your end, use SFTP, not FTP. Then you can download DreamHost’s default php.ini. As long as you’re using a clean text editor that doesn’t add DOS linefeeds, you’re in good shape. Filezilla does SFTP and has a built in text editor.

-Scott


#3

Thanks a lot for your reply. I have tried to do everything at my side and upload through SFTP. The only part that I don’t understand and skipped is “Set permissions” from http://wiki.dreamhost.com/PHP.ini

Here are my steps:

  1. created a “cgi-bin” folder
  2. copy dreamhost original php.ini file and modify the upload_max_filesize value to 100M
  3. created php-wrapper.fcgi file using notepad (encoding ANSI) with the content:

#!/bin/sh
export PHPRC=/home/MY USERNAME/fotobucks.com/cgi-bin
exec /dh/cgi-system/php5.cgi $*

  1. created .htaccess file using notepad (encoding ANSI) with the content:

Options +ExecCGI
AddHandler php5-cgi .php
Action php-cgi /cgi-bin/php-wrapper.fcgi
Action php5-cgi /cgi-bin/php-wrapper.fcgi

However, after I check, it still shows upload_max_filesize is 7M. What I have done wrong? What should I do to make it works? Thanks.


#4

Notepad typically screws up text files when used in a Linux environment. Hopefully your SFTP program has a built in text editor. Try that one and see how the files look. Or try the WebFTP interface from the panel here.

WebFTP and/or your SFTP program can set the permissions as directed.

-Scott


#5

I have tried to view the file in webftp. The text appear to be the same like in notepad. I also changed the permission setting using my SFTP program, that is FireFTP.

But, it still shows the upload_max_filesize is 7M. What else do I need to do to make it works? Thanks.


#6

Notepad is fine. Check phpinfo() to see if it’s actually loading your custom php.ini

<?php ;phpinfo() ;?>Have you edited the appropriate settings in your custom php.ini (in the cgi-bin directory) in order to change the upload limit from the 7M default to something higher? If so, which settings did you change?

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#7

Is it Wordpad that always screws up text files? Notepad is really plain text?

-Scott


#8

The issue isn’t whether the file is plain text or not - the problem with Notepad is that it creates files with Windows line endings. Some Linux programs are fine with this, but some things (shell scripts, in particular) get very confused by the “wrong” line endings. This is why we recommend using something else, like pico (in a shell) to do this sort of work!


#9

Thanks for all your replies. I have checked, it still loads the original php.ini. I have changed the value of upload_max_filesize to 100M.

Regarding Windows line endings, I have tried to view those files in webftp. It seems that all is display clean & properly.


#10

One thing I need to highlight here, I am using Joomla to run the site. What else that I need to do for the PHP modification works? Thanks.


#11

Guys, I really need your help. Otherwise, I can’t proceed to develop the website. Thanks.


#12

You’ll need to give yourself SSH/Shell access and use PuTTY to log in and examine what you have so far.
http://wiki.dreamhost.com/Enabling_Shell_Access
http://wiki.dreamhost.com/Ssh

First order is to run the dos2unix command on each file you’ve uploaded. Here are some shell tips:
http://wiki.dreamhost.com/Shell_Commands

While you’re logged in, check permissions to see if they match what was required in the wiki:
http://wiki.dreamhost.com/Unix_File_Permissions

-Scott


#13

Thanks a lot for your reply. I have found the problem, that is I uploaded .htaccess file to wrong place. Seems I am using Joomla, therefore I opened Joomla’s .htaccess file and then added:

Options +ExecCGI
AddHandler php5-cgi .php
Action php-cgi /cgi-bin/php-wrapper.fcgi
Action php5-cgi /cgi-bin/php-wrapper.fcgi

at the end of the file in freespire OS. However, after I uploaded the file to the server using FireFTP in Windows, the website is now stopped working and displaying error message “500 Internal Server Error”. How could I solve the problem? Thanks.


#14

Thanks a lot for your GREAT help. The system is now working properly with the modified PHP upload limit.


#15

Cool. How did you fix the 500 Error?

-Scott


#16

That error is actually caused by php-wrapper.fcgi. After, I recreate the file using putty.exe, Joomla shows that maximum file upload is now 200MB which I set in php.ini. But, I haven’t try to do huge file size upload test. Anyway, thanks for your great help.