Changing upload_max_filesize on PHP(在 PHP 上更改 upload_max_filesize)
问题描述
我正在使用 PHP 5.3.0,并且遇到了一些可能是错误(在这种情况下我会报告它)或者可能是我的问题 - 所以我要求确认一下.
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.
运行此代码时:
<?php
ini_set('upload_max_filesize', '10M');
echo ini_get('upload_max_filesize'), ", " , ini_get('post_max_size')
我最终得到:
2M, 8M
尽管我的 php.ini 设置得更高:
This is despite my php.ini setting these higher:
upload_max_filesize = 10M
post_max_size = 10M
(只出现一次)
因为在设置值以及在 php.ini 中设置值之后发生错误,所以我倾向于认为这是一个错误.谁能确认或指出我哪里出错了?
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?
更新:看起来重启 Apache 解决了这个问题 - 我一直认为如果你更改了 php.ini,它就不需要重启.
Update: Looks like restarting Apache fixed this - I always thought it didn't need to be restarted if you changed php.ini.
推荐答案
你不能使用 速记符号 在 PHP.ini 之外设置配置值.我认为当遇到错误值时,它会回落到 2MB 作为编译默认值.
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.
另一方面,我不认为 upload_max_filesize
可以使用 ini_set()
设置.官方"列表声明它是 PHP_INI_PERDIR代码> .
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 PHP 上更改 upload_max_filesize


基础教程推荐
- Libpuzzle 索引数百万张图片? 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 在多维数组中查找最大值 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01