CodeIgniter Forums
Increase server upload limit - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Increase server upload limit (/showthread.php?tid=30807)

Pages: 1 2


Increase server upload limit - El Forum - 05-26-2010

[eluser]vaxis[/eluser]
Hi guys,
In my current project i have a page where i can upload images, but i have problems with file bigger than 8Mb because my server ini.php file is set like that...

I tried to use this code in index.php file:
Code:
set_time_limit(0);
ini_set('post_max_size', 50);
ini_set('upload_max_filesize', 50);
ini_set('memory_limit', -1);
ini_set('max_input_time', -1);
ini_set('max_execution_time',-1);
        
echo  ini_get('post_max_size').'<br />';
echo  ini_get('upload_max_filesize').'<br />';
echo  ini_get('max_input_time').'<br />';
echo  ini_get('memory_limit').'<br />';
echo ini_get('max_execution_time');


But upload size doesn't change.
I also tried to use a .htaccess file with this rows:
Code:
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200

But i get a Server Internal Error.
Someone knows a good method to increase server upload limit?

Thanks all.


Increase server upload limit - El Forum - 05-26-2010

[eluser]ranjudsokomora[/eluser]
[quote author="vaxis" date="1274908521"]Hi guys,
In my current project i have a page where i can upload images, but i have problems with file bigger than 8Mb because my server ini.php file is set like that...

I tried to use this code in index.php file:
Code:
set_time_limit(0);
ini_set('post_max_size', 50);
ini_set('upload_max_filesize', 50);
ini_set('memory_limit', -1);
ini_set('max_input_time', -1);
ini_set('max_execution_time',-1);
        
echo  ini_get('post_max_size').'<br />';
echo  ini_get('upload_max_filesize').'<br />';
echo  ini_get('max_input_time').'<br />';
echo  ini_get('memory_limit').'<br />';
echo ini_get('max_execution_time');

[/quote]

The first thing I would do is try and change the php.ini file. However if you can't changed that, here would be my settings in php
Code:
ini_set('post_max_size','50M');
ini_set('upload_max_size','55M');
ini_set('memory_limit','128M');



Increase server upload limit - El Forum - 05-26-2010

[eluser]vaxis[/eluser]
[quote author="ranjudsokomora" date="1274909474"]

The first thing I would do is try and change the php.ini file. However if you can't changed that, here would be my settings in php
Code:
ini_set('post_max_size','50M');
ini_set('upload_max_size','55M');
ini_set('memory_limit','128M');
[/quote]

Hi ranjudsokomora, thanks for reply.
I just tried with that rows but it doesn't solve my problem Sad it seems that it only change the memory_limit but not other stuff.
I also tried to create a ini.php file in my root folder but i also get a Internal 500 error.
There is a different way for doing this?

Thanks again.


Increase server upload limit - El Forum - 05-26-2010

[eluser]ranjudsokomora[/eluser]
vaxis
What type of server environment are you on?


Increase server upload limit - El Forum - 05-26-2010

[eluser]danmontgomery[/eluser]
5 minutes spent on google reveals:

http://bytes.com/topic/php/answers/11666-file-upload-max-size
Quote:post_max_size and upload_max_filesize aren't settable at runtime, because
that's too late. The PHP only runs after the file has been uploaded, i.e. it
can't reach the ini_set until the upload_max_filesize has already been
exceeded. See http://uk.php.net/manual/en/ini.php#ini.list which lists where
each can be changed.

memory_limit can be changed, since you can set it before you use up all the
memory.

You can change these either in the global php.ini file, or per-directory under
Apache using .htaccess files.

And php.net confirms:

http://www.php.net/manual/en/ini.list.php
Quote:post_max_size "8M" PHP_INI_PERDIR PHP_INI_SYSTEM in PHP <= 4.2.3. Available since PHP 4.0.3.

http://php.net/manual/en/configuration.changes.modes.php
Quote:PHP_INI_PERDIR 6 Entry can be set in php.ini, .htaccess or httpd.conf



Increase server upload limit - El Forum - 05-26-2010

[eluser]cahva[/eluser]
And as you cannot set those in .htaccess(you get an internal server error by using php_value), you must ask your host to set them. If you're on a shared server, its quite understandable that those cannot be set by user(althought its strange that you cant use php_value at all as there are many other settings user usually can set).

BTW, if you get an internal server error, you can find the error in the logs(http-error_log or similar).


Increase server upload limit - El Forum - 05-26-2010

[eluser]vaxis[/eluser]
I'm on a shared linux server, but this project is a cms and i don't know on which server it will run... So there isn't a way to allow file upload that are bigger than 8Mb without contacting my host?

Thanks for answers Smile


Increase server upload limit - El Forum - 05-26-2010

[eluser]cahva[/eluser]
Just contact your host Smile I dont know why people are so afraid to contact their host. I work in hosting firm and atleast in Finland we usually help our customers as much as possible(and even answer questions that arent even supposed to be answered by us Smile ). I see no reason for your host to not ramp up the limits a little bit.


Increase server upload limit - El Forum - 05-27-2010

[eluser]Crimp[/eluser]
It depends on how your provider/server runs PHP. If under FastCGI, they may allow php.ini to be set and changed per user. But it would likely be advertised as a feature up front.

Shared hosting does not lend itself to special applications. Saved myself a lot of headaches when I moved on to manage servers. Instead of having to troubleshoot and deal with support, you could simply have logged on, changed the values and moved on with your coding.

Shared hosts will for many reasons not welcome large file uploads by users.


Increase server upload limit - El Forum - 05-27-2010

[eluser]cahva[/eluser]
[quote author="Crimp" date="1274961393"]
Shared hosts will for many reasons not welcome large file uploads by users.[/quote]
Name one reason? Smile Well we dont have any probs if our clients wants to upload large files.. Its their own webspace they are using and if they hit their quota then they cant upload anymore, simple as that.