在PHP上更改upload_max_filesize [英] Changing upload_max_filesize on PHP
问题描述
我正在使用PHP 5.3.0,并且遇到了可能是错误的情况(在这种情况下,我将进行报告)或可能是我-所以我要求确定.
运行此代码时:
<?php
ini_set('upload_max_filesize', '10M');
echo ini_get('upload_max_filesize'), ", " , ini_get('post_max_size')
我最终得到:
2M, 8M
尽管我的php.ini将这些设置设置得更高:
upload_max_filesize = 10M
post_max_size = 10M
(仅发生一次)
因为在设置值以及在php.ini中设置值后都会发生错误,所以我倾向于认为这是一个错误.有人可以确认或指出我要去哪里吗?
更新:看起来像重新启动Apache修复了此问题-我一直认为,如果您更改了php.ini,则不需要重新启动它.
您不能使用官方"列表指出它是PHP_INI_PERDIR
.>
I'm using PHP 5.3.0 and have encountered something that might be a bug (in which case I'll report it) or might be me - so I'm asking to make sure.
When running this code:
<?php
ini_set('upload_max_filesize', '10M');
echo ini_get('upload_max_filesize'), ", " , ini_get('post_max_size')
I end up with:
2M, 8M
This is despite my php.ini setting these higher:
upload_max_filesize = 10M
post_max_size = 10M
(occuring only once)
Because the error occurs after setting the value as well as it being set in php.ini I'm inclined to think it's a bug. Can anyone confirm or point me where I'm going wrong?
Update: Looks like restarting Apache fixed this - I always thought it didn't need to be restarted if you changed php.ini.
You can't use shorthand notation to set configuration values outside of PHP.ini. I assume it's falling back to 2MB as the compiled default when confronted with a bad value.
On the other hand, I don't think upload_max_filesize
could be set using ini_set()
. The "official" list states that it is PHP_INI_PERDIR
.
这篇关于在PHP上更改upload_max_filesize的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!