Does something in the php.ini have to be enabled for...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dallasx
Forum Contributor
Posts: 106
Joined: Thu Oct 20, 2005 4:55 pm
Location: California

Does something in the php.ini have to be enabled for...

Post by dallasx »

Does something have to be uncommented for the file operations such as uploading files in the php.ini?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

file_uploads = On
upload_max_size = 10M

It should already be defaulted to "On" with a 2MB limit.
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Post by Skittlewidth »

Out of interest, can you override the 2mb limit using ini_set()?

I don't think our hosts would be so kind to change the ini file despite the money we throw at them..
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Skittlewidth wrote:Out of interest, can you override the 2mb limit using ini_set()?

I don't think our hosts would be so kind to change the ini file despite the money we throw at them..
Given what it's in the ini file for I very much doubt ini_set() allows it. It's kinda a security/bandwidth thing for server admins.

If you're unhappy with shared hosting you could perhaps try UML hosting, which is still fairly cheap but gives you the freedom to do what you like with php etc.
conthox
Forum Commoner
Posts: 39
Joined: Tue Jun 25, 2002 1:44 pm
Location: Sweden

Post by conthox »

Skittlewidth wrote:Out of interest, can you override the 2mb limit using ini_set()?

I don't think our hosts would be so kind to change the ini file despite the money we throw at them..
You may use .htaccess instead of ini_set() or php.ini:

Code: Select all

<Limit GET POST> 
php_value upload_max_filesize "8M" 
</Limit> 
 
php_value post_max_size "10M" 
 
php_value memory_limit "12M" 
 
php_value max_execution_time "600"
The "php_value max_execution_time" setting isn't needed if the connection is fast enough. The global limit is set in the Apache settings, not in php.ini.
Post Reply