PHP post_max_size本地值被Plesk / IIS上的主值覆盖? [英] PHP post_max_size local value overridden by master value on Plesk / IIS?

查看:167
本文介绍了PHP post_max_size本地值被Plesk / IIS上的主值覆盖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在通过PHP上传大文件时遇到了一个奇怪的问题(通过Drupal,虽然这不是问题)。

I'm running into a strange issue when uploading large files via PHP (through Drupal, though that's not the issue).

基本上,我的文件上传失败了到达post_max_size限制,即使local指令设置为96M,文件为25M。

Basically, my file uploads fail due to post_max_size limits being reached, even though the local directive is set to 96M, and the file is 25M.

我确保其他一切都是正确的,包括 max_input_time max_upload_filesize ,以及IIS FastCGI空闲时间。所有这些都很大而不是问题。

I've ensured everything else is correct, including max_input_time, max_upload_filesize, and the IIS FastCGI idle time. All these are plenty large and not the issue.

我通过Plesk覆盖 post_max_size 指令,(I相信)将更改存储在注册表值中。在域上运行phpinfo()会显示所有指令的正确本地值和主值... 96M本地,12M主站。

I am overriding the post_max_size directive through Plesk, which (I believe) stores the change in a registry value. Running phpinfo() on the domain shows the correct local and master values for all directives...96M local, 12M master.

非常奇怪的是当我改变时php.ini中的主 post_max_size 从12M到96M(并确保更改已生效),它正常工作!更改主值到12M(保持本地值为96M)会立即导致上传再次失败。

The very strange thing is that when I change the master post_max_size in php.ini from 12M to 96M (and ensure the change has taken effect), it works normally! Changing the master value back to 12M (and keeping a local value of 96M) immediately causes uploads to fail again.

这是PHP中的错误,还是我做错了?

Is this a bug in PHP, or am I doing it wrong?

推荐答案

事实证明,在Windows上,您只能设置标记为 PHP_INI_USER 每个目录。不幸的是, upload_max_filesize post_max_size 都是 PHP_INI_PERDIR 。来自 http://php.net/manual/en/configuration.changes上的PHP文档。 php

As it turns out, on Windows, you can only set ini directives that are marked PHP_INI_USER per directory. Unfortunately, upload_max_filesize and post_max_size are both PHP_INI_PERDIR. From the PHP docs at http://php.net/manual/en/configuration.changes.php


对于从该目录或其任何子目录运行的任何脚本,该目录的设置都将处于活动状态。密钥下的值应具有PHP配置指令的名称和字符串值。不解析值中的PHP常量。 但是,只有PHP_INI_USER中可更改的配置值可以这种方式设置,PHP_INI_PERDIR值不能。

所以即使Plesk有一个更改这些指令的界面,即使 phpinfo()选择了它们,也无法改变实际的最大上传大小。 Plesk不允许你在Windows上更改那些,而 phpinfo()不应该报告更改,但你可以做什么。

So even though Plesk has an interface to change those directives, and even though phpinfo() picks up on them, they do nothing to change the actual max upload sizes. Plesk should not allow you to change those on Windows, and phpinfo() should not report the change, but what can you do.

这篇关于PHP post_max_size本地值被Plesk / IIS上的主值覆盖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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