Manoj Negi
Manoj Negi

Reputation: 174

Getting 500 internal server error while changing the size of max file upload

when i tried to increase the size of php_value upload_max_filesize on live server using .htaccess it is showing the 500 Internal server error. but the same is working fine on local server This is my .htaccess code

        RewriteOptions inherit
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f 
        RewriteCond %{REQUEST_FILENAME} !-d 
        RewriteRule ^(.*)$ index.php?/$1 [L]
        php_value post_max_size 20M
        php_value upload_max_filesize 20M

Upvotes: 1

Views: 3195

Answers (2)

Manoj Negi
Manoj Negi

Reputation: 174

Hey finally i got the answer i added some line of code in my controller

function __construct()
{

@ini_set( 'upload_max_size' , '50M' );
@ini_set( 'post_max_size', '50M');
@ini_set( 'max_execution_time', '300' );
}

Hope this will help someone

Upvotes: 2

Bikash
Bikash

Reputation: 1938

As far as I can tell, your syntax is correct. However, the php_value Apache directive is provided by the mod_php module. If you don't run PHP as Apache module (e.g., it runs as FastCGI or with some other SAPI) that directive won't be defined, thus the 500 error.

There're many ways to change PHP settings. In practice, I've found that hosting services that run CGI often provide a custom php.ini file somewhere in your FTP account. Additionally, if you run PHP/5.3.0 or newer you can use .user.ini files. Last but not least, there's ini_set() within code.

Upvotes: 4

Related Questions