TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-24-2008, 01:34 PM   #1 (permalink)
The Wanderer
 
killer-kurt's Avatar
 
Join Date: Apr 2008
Posts: 10
Thanks: 2
killer-kurt is on a distinguished road
Default PHP.ini change upload limit

Hey guys,

I do appoligies if this is already here somewhere but i did take a look and found nothing. I want to change the upload limit in my PHP.ini on my server so i can upload bigger files on my forum. Could someone please tell me how to go about doing this. I can display the info for my php.ini but when it comes to PHP thats about it so everything will have to be explained.

Thanks in advance.
__________________
killer-kurt is offline  
Reply With Quote
Old 04-24-2008, 01:43 PM   #2 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,298
Thanks: 17
Village Idiot is on a distinguished road
Default

There is no set size limit PHP sets, you can set the timeout limit so larger files dont time out.
PHP: set_time_limit - Manual

However, browsers have their own (extremely long) timeout limit. The only way to upload super large files is to use ajax.
__________________

Village Idiot is offline  
Reply With Quote
Old 04-24-2008, 01:48 PM   #3 (permalink)
The Wanderer
 
killer-kurt's Avatar
 
Join Date: Apr 2008
Posts: 10
Thanks: 2
killer-kurt is on a distinguished road
Default

So when i try to upload a file and it returns the error

"The attachment’s file size is too large, the maximum upload size is 2 MB.
Please note this is set in php.ini and cannot be overridden."

This is because of a timeout limit?
__________________
killer-kurt is offline  
Reply With Quote
Old 04-24-2008, 01:49 PM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,267
Thanks: 90
Wildhoney is on a distinguished road
Default

There are 2 INI variables that relate to the size of the uploads. Namely:

php Code:
ini_set('upload_max_filesize', '200M');
ini_set('post_max_size', '200M');
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 04-24-2008, 01:49 PM   #5 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,298
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by Wildhoney View Post
There are 2 INI variables that relate to the size of the uploads. Namely:

php Code:
ini_set('upload_max_filesize', '200M');
ini_set('post_max_size', '200M');
Didn't know PHP had that.
__________________

Village Idiot is offline  
Reply With Quote
Old 04-24-2008, 01:52 PM   #6 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,267
Thanks: 90
Wildhoney is on a distinguished road
Default

Quote:
Files are usually POSTed to the webserver in a format known as 'multipart/form-data'. The post_max_size sets the upper limit on the amount of data that a script can accept in this manner. Ideally this value should be larger than the value that you set for upload_max_filesize.

It's important to realize that upload_max_filesize is the sum of the sizes of all the files that you are uploading. post_max_size is the upload_max_filesize plus the sum of the lengths of all the other fields in the form plus any mime headers that the encoder might include. Since these fields are typically small you can often approximate the upload max size to the post max size.
Source: PHP File Upload Configuration
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
killer-kurt (05-01-2008)
Old 04-24-2008, 02:07 PM   #7 (permalink)
The Wanderer
 
killer-kurt's Avatar
 
Join Date: Apr 2008
Posts: 10
Thanks: 2
killer-kurt is on a distinguished road
Default

Ok well i set it out like this in a page and loaded it:

Code:
<?
ini_set('upload_max_filesize', '300M');
ini_set('post_max_size', '300M');

 ?>
But it dident do nothing.

Is this correct??
__________________
killer-kurt is offline  
Reply With Quote
Old 04-24-2008, 02:15 PM   #8 (permalink)
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
Evulness is on a distinguished road
Default

in your php.ini on line 552.
approx. halfway through the doc. you will see
Quote:
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = "c:/httpd/tmp"

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
change that?
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote
Old 04-24-2008, 02:19 PM   #9 (permalink)
The Wanderer
 
killer-kurt's Avatar
 
Join Date: Apr 2008
Posts: 10
Thanks: 2
killer-kurt is on a distinguished road
Default

I dont have access to the php.ini on the server.
__________________
killer-kurt is offline  
Reply With Quote
Old 04-24-2008, 03:36 PM   #10 (permalink)
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
Evulness is on a distinguished road
Default

then you either have to contact the system admin, and have them do it... or.. i don't know They probably have the ability to change ini settings disabled, hense why the ini code wildhoney gave didn't work...
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote
Old 04-24-2008, 04:18 PM   #11 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,381
Thanks: 5
Salathe is on a distinguished road
Default

Depending on your server configuration, it might be possible to do one of the following:
  • Create a custom php.ini file for your website (or a sub-folder) with the necessary settings only.
  • Create a .htaccess file with php_value or php_flag declarations for the settings.
Salathe is offline  
Reply With Quote
Old 04-24-2008, 04:26 PM   #12 (permalink)
The Wanderer
 
killer-kurt's Avatar
 
Join Date: Apr 2008
Posts: 10
Thanks: 2
killer-kurt is on a distinguished road
Default

Ok could you please guide me on how to do the first one (creating the custom php.ini in a sub folder) and attach it please. If that dont work then try the second?
__________________
killer-kurt is offline  
Reply With Quote
Old 04-28-2008, 05:13 AM   #13 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

Quote:
Originally Posted by killer-kurt View Post
Ok could you please guide me on how to do the first one (creating the custom php.ini in a sub folder) and attach it please. If that dont work then try the second?
if your using a paid server look in the administration part of the place your logging in and look everywhere for php.ini if you find it view it then you can configure the upload settings.

if you cant find it anywhere you cant do anything else you have to contact the company or the administrator of the server to grant you access.
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 04-28-2008, 10:53 AM   #14 (permalink)
The Wanderer
 
killer-kurt's Avatar
 
Join Date: Apr 2008
Posts: 10
Thanks: 2
killer-kurt is on a distinguished road
Default

I have looked for the php.ini its not there and have contacted my host and they will not allow anyone to change the file.
__________________
killer-kurt is offline  
Reply With Quote
Old 04-28-2008, 11:32 AM   #15 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,381
Thanks: 5
Salathe is on a distinguished road
Default

Quote:
Originally Posted by killer-kurt View Post
Ok could you please guide me on how to do the first one (creating the custom php.ini in a sub folder) and attach it please. If that dont work then try the second?
Per-directory PHP.ini
Put a file named php.ini in your web root folder (often looks like /home/username/public_html) with the content:
INI Code:
upload_max_filesize = 300M
post_max_size = 300M

Per-directory .htaccess
Put a file named .htaccess in your web root folder:
HTACCESS Code:
php_value upload_max_filesize 300M
php_value post_max_size 300M

No guarantees but one or the other might work (or both, but don't use both!).
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
killer-kurt (05-01-2008)
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 03:14 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design