简体   繁体   English

更改 php.ini 中的“upload_max_filesize”不会更改 phpinfo() 中的值

[英]Changing 'upload_max_filesize' in php.ini does not change the value in phpinfo()

I'm using Wordpress via Bitnami + Xampp and am trying to change the upload_max_filesize variable since 2M is way too small.我正在通过 Bitnami + Xampp 使用 Wordpress,并试图更改upload_max_filesize变量,因为 2M 太小了。 So I change it to 64M as shown here:所以我将其更改为 64M,如下所示:

php.ini 文件

I also have post_max_size=64M .我也有post_max_size=64M

However, Wordpress still shows that the max upload size is only 2M.但是,Wordpress 仍然显示最大上传大小仅为 2M。

只有2M?

I went to phpinfo() to look into the issue.我去phpinfo()调查这个问题。 I am editing the correct php.ini file that is being pointed too.我正在编辑指向的正确 php.ini 文件。 And, on top of that, phpinfo() shows that upload_max_filesize is still set to 2M!而且,最重要的是, phpinfo()显示upload_max_filesize仍然设置为2M!

什么鬼...

Yes, I did restart the Apache server on Xampp (by clicking stop, then start).是的,我确实在 Xampp 上重新启动了 Apache 服务器(通过单击停止,然后单击启动)。 And I tried changing some Wordpress defined variables as described in this blog post .我尝试更改一些 Wordpress 定义的变量,如这篇博客文章中所述

Common mistake is to assume that changing upload_max_filesize is sufficient.常见的错误是假设更改upload_max_filesize就足够了。 It is not.它不是。 Because file upload goes via POST request you must also change post_max_size which must be at least the same value (I'd add a bit atop).因为文件上传是通过 POST 请求进行的,所以您还必须更改post_max_size ,它必须至少具有相同的值(我会在上面添加一点)。

Alright, figured it out.好吧,想通了。 Problem is, I'm not sure how it worked.问题是,我不确定它是如何工作的。

So I was using port 8080 since port 80 wasn't working for some reason.所以我使用了端口 8080,因为端口 80 由于某种原因无法正常工作。 After restarting my computer, I started Apache up again.重新启动计算机后,我再次启动了 Apache。 This time, it didn't work on port 8080. So I changed it back to port 80 and now, well, it works.这一次,它在端口 8080 上不起作用。所以我把它改回端口 80,现在,它起作用了。

No idea why this is the solution.不知道为什么这是解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM