upload_max_filesize在phpinfo()中设置为4M,无法更改!

发布于 2024-11-08 00:08:24 字数 633 浏览 0 评论 0原文

我在 php.ini 中有这个

upload_max_filesize = 25M
post_max_size = 25M

,在 .htaccess 中有这个

php_value upload_max_filesize 26214400
php_value post_max_size 26214400

,因为速记只能在 php.ini 中使用(http://www.php.net/manual/en/faq.using)。 php#faq.using.shorthandbytes)

但无论我做什么,当我调用 phpinfo() 时,我发现

Directive               Local Value     Master Value
upload_max_filesize     4M              25M

我已经查看了所有其他 php.ini 文件、我的 .htaccess、ini_set()。我能想到的任何事情都不会改变4M。任何帮助都会很棒!

编辑:重新启动 apache 不起作用,我检查了我的 httpd.conf,它似乎是一个外部文件或其他东西。还有其他地方可以检查吗?

I've got this in my php.ini

upload_max_filesize = 25M
post_max_size = 25M

and I've got this in my .htaccess

php_value upload_max_filesize 26214400
php_value post_max_size 26214400

as shorthand can only be used in the php.ini (http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes)

but no matter what I do, when i call phpinfo() I get

Directive               Local Value     Master Value
upload_max_filesize     4M              25M

I've looked at all other php.ini files, my .htaccess, ini_set(). Anything I could think of and nothing will change it from 4M. Any help would be great!

EDIT: restarting apache didn't work, i've check my httpd.conf, it seems like an external file or something. any other places to check?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(13

像你 2024-11-15 00:08:25

这看起来不像 php.ini 文件的正确语法。

upload_max_filesize = 25M
post_max_size = 25M

然后,确保重新启动 Apache。

如果仍有问题,请参考:
http://www.cyberciti.biz/faq/linux-unix-apache -增加-php-upload-limit/

That doesn't look like proper syntax for a php.ini file.

upload_max_filesize = 25M
post_max_size = 25M

Then, make sure to restart Apache.

If you still have troubles, refer to:
http://www.cyberciti.biz/faq/linux-unix-apache-increase-php-upload-limit/

微暖i 2024-11-15 00:08:25

我有同样的问题,但重新启动 php-fpm 有帮助。
因此,仅重新启动 apache2 并没有帮助,但是此命令:

sudo systemctl restart php7.3-fpm

清除了可能的一些缓存并获取了新修改的 php.ini

I had same issue, but restarting php-fpm helped.
So it didn't help to restart just apache2, but this command:

sudo systemctl restart php7.3-fpm

Cleared probably some cache and took the new modified php.ini.

月亮坠入山谷 2024-11-15 00:08:25

如果您使用的是 OSX,请使用命令 php --ini 确保您的 php.ini 文件不是 /etc 中的默认文件 (php.ini.default),
输出示例:

Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /Library/Server/Web/Config/php
Additional .ini files parsed:      (none)

如果第一行:带有空参数的配置文件 (php.ini) 路径,请复制默认的 php ini,并且更改将生效。

If you're using OSX then make sure your php.ini file is not the default one in /etc (php.ini.default) with the command php --ini,
output sample :

Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /Library/Server/Web/Config/php
Additional .ini files parsed:      (none)

in case the first line: Configuration File (php.ini) Path with empty parameter make a copy of the default php ini and the changes will take affect.

胡大本事 2024-11-15 00:08:25

确保您正在编辑 conf/"server_version" 文件夹中的 php.ini

Make sure that you're editing the php.ini in the conf/"server_version" folder

捎一片雪花 2024-11-15 00:08:25

另外,您还必须检查 memory_limit 指令。

如果它低于 upload_max_filesize 或 post_max_size 那么它们的值将被限制为 memory_limit 值。

无论如何,post_max_size 应略大于 upload_max_filesize(除文件本身之外的任何发布值也需要一些内存)

在现代系统上,memory_limit 应至少为 64M,建议 128M 或更多

also, you'll have to check the memory_limit directive.

If it's lower than upload_max_filesize or post_max_size then their value will be limited to the memory_limit value.

Anyway, post_max_size should be slightly larger than upload_max_filesize (any posted values other than the file itself would need some memory as well)

On modern systems, memory_limit should be at least 64M, 128M or more is recommended

对你而言 2024-11-15 00:08:25

如果您正在运行 PHP Fast cgi,那么您需要重新启动该进程。我相信重新启动 apache 应该可以解决问题。

If you are running PHP Fast cgi then you need to restart the process. I believe that restarting apache should do the trick.

病女 2024-11-15 00:08:25

问题是它实际上是在另一个 .ini 文件中设置的,乍一看似乎与任何内容都没有关系!

自我提醒:当事情可疑时,始终使用“grep”在文件中搜索!

Problem was it was actually being set in another .ini file that didn't appear at first glance to be related to anything!

Note to self: always use "grep" to search within files when things are fishy!

放血 2024-11-15 00:08:25

如果您在本地服务器(例如 wamp 或 xampp)中运行,请确保它使用您认为的 php.ini。这些服务器通常默认使用不在您的 html 文档文件夹中的 php.ini。

If you are running in a local server, such as wamp or xampp, make sure it's using the php.ini you think it is. These servers usually default to a php.ini that's not in your html docs folder.

2024-11-15 00:08:25

如果您使用的是 WAMP,请在 apache 使用的适当 php.ini 中进行更改,通常位于 C:\wamp\bin\apache\\bin 中。

将 post_max_size 和 upload_max_filesize (通常在第 734 行和 886 行中找到)的 2 个参数更改为 50M(上传最大 50 MB 的文件)。

不要忘记重新启动apache。

If you are using WAMP then make changes in proper php.ini which apache uses, normally its found in C:\wamp\bin\apache\\bin.

make changes in 2 parameters post_max_size and upload_max_filesize (found in line 734 and 886, usually), to 50M (to upload files upto 50 MB).

don't forget to restart apache.

甜`诱少女 2024-11-15 00:08:25

我可以通过解决方法解决这个问题。我在 web 应用程序的根文档中创建了 .user.ini 文件并覆盖这些值。

I could solve this problem via a workaround. I created .user.ini file in the root document of my webapp and overwrite the values.

℉絮湮 2024-11-15 00:08:25

我面临着同样的问题。
检查 php info 中加载的配置文件路径。
然后打开该文件并更改所需的变量并重新启动 apache 服务器。

I was facing the same issue.
Check Loaded Configuration File path in php info.
Then open that file and change the variables you want and restart your apache server.

弥枳 2024-11-15 00:08:25

如果您使用cPanel/WHM,请使用MultiPHP INI编辑器在cPanel(本地值)和WHM(主值)>>>中进行更新重新启动 Apache 或其他 Web 服务器。

If you are using cPanel/WHM, use MultiPHP INI Editor to update in cPanel (Local Value) and WHM (Master Value) >> Restart Apache or other web server.

感性不性感 2024-11-15 00:08:25

确保您的计算机没有在 php.ini 文件末尾隐藏 .txt

使用终端或右键单击/获取信息或属性。

Make sure that your computer is not hiding a .txt on the end of the php.ini file.

Use terminal or right click / get info or properties.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文