Advertisement
Advertisement


How to set upload_max_filesize in .htaccess?


Question

I have try to put theese 2 lines

php_value post_max_size 30M
php_value upload_max_filesize 30M

in my root .htaccess file but that brings me "internal server error" message ...
php5 is running on the server
I don't have access to php.ini so i think htaccess is my only chance.
Can you tell me where is the mistake?
Thanks in advance

2012/07/12
1
90
7/12/2012 5:28:32 PM

Accepted Answer

php_value upload_max_filesize 30M is correct.

You will have to contact your hosters -- some don't allow you to change values in php.ini

2010/06/07
137
6/7/2010 8:16:54 PM

If you are getting 500 - Internal server error that means you don't have permission to set these values by .htaccess. You have to contact your web server providers and ask to set AllowOverride Options for your host or to put these lines in their virtual host configuration file.

2010/06/07

php_value memory_limit 30M
php_value post_max_size 100M
php_value upload_max_filesize 30M

Use all 3 in .htaccess after everything at last line. php_value post_max_size must be more than than the remaining two.

2015/01/12

What to do to correct this is create a file called php.ini and save it in the same location as your .htaccess file and enter the following code instead:

upload_max_filesize = "250M"
post_max_size = "250M"
2014/02/23

If your web server is running php5, I believe you must use php5_value. This resolved the same error I received when using php_value.

2012/12/01

Both commands are correct

php_value post_max_size 30M 
php_value upload_max_filesize 30M 

BUT to use the .htaccess you have to enable rewrite_module in Apache config file. In httpd.conf find this line:

# LoadModule rewrite_module modules/mod_rewrite.so

and remove the #.

2016/05/24

Source: https://stackoverflow.com/questions/2992376
Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Email: [email protected]