在 PHP 上更改 upload_max_filesize [英] Changing upload_max_filesize on PHP

查看:17
本文介绍了在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆