dsfdgdsfd23212
2010-06-07 19:14
浏览 228
已采纳

如何在.htaccess中设置upload_max_filesize?

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

图片转代码服务由CSDN问答提供 功能建议

我试图把theese 2行

  php_value post_max_size 在我的root .htaccess文件中30M 
php_value upload_max_filesize 30M 
   
 
 

但是这会给我带来“内部服务器错误”消息...
\ 服务器
我没有访问php.ini所以我认为htaccess是我唯一的机会。
你能告诉我哪里出错了吗?
提前谢谢

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

6条回答 默认 最新

  • dty5753 2010-06-07 19:24
    已采纳

    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

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • donglu1973 2010-06-07 19:52

    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.

    评论
    解决 无用
    打赏 举报
  • duanputian5341 2011-01-27 12:33

    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.

    评论
    解决 无用
    打赏 举报
  • doujiao1981 2012-02-27 14:40

    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"
    
    评论
    解决 无用
    打赏 举报
  • douwanc63652 2014-07-13 09:23
    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.

    评论
    解决 无用
    打赏 举报
  • dsour68888 2016-05-24 09:00

    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 #.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题