更改了 php.ini 中的 upload_max_filesize 但 phpinfo 未显示更改
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13638868/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Changed upload_max_filesize in php.ini but phpinfo doesn't show the change
提问by Amir
Basically phpinfo says upload_max_filesize is 2M, but I changed it in the php.ini file to 8M. I am using MAMP, so I restarted MAMP and phpinfo still says 2M. I checked the path to the php.ini file that phpinfo shows and it matched up exactly. See the YouTube video of me documenting all of this.
基本上phpinfo说upload_max_filesize是2M,但是我在php.ini文件里把它改成了8M。我正在使用 MAMP,所以我重新启动了 MAMP,phpinfo 仍然显示 2M。我检查了 phpinfo 显示的 php.ini 文件的路径,它完全匹配。请参阅我记录所有这些的 YouTube 视频。
采纳答案by Amir
In httpd.conf file the PhpIniDir had the wrong path. It was off by one directory. That was the fix!
在 httpd.conf 文件中,PhpIniDir 的路径错误。它被一个目录关闭。这就是修复!
回答by Lucio Fonseca
You should change the file in /Applications/MAMP/bin/php/php5.4.10/conf/php.ini
您应该更改 /Applications/MAMP/bin/php/php5.4.10/conf/php.ini 中的文件
After you should reset MAMP. I also changed all php.ini before, and phpinfo() doesn't had been change, but I don't sure if it is need to works, so if only changing the file in the path above, try change the others also.
在您应该重置 MAMP 之后。我之前也更改了所有 php.ini,而 phpinfo() 没有更改,但我不确定它是否需要工作,所以如果只更改上面路径中的文件,请尝试更改其他文件。
I hope that help you.
我希望对你有帮助。
回答by FrancescoMM
To be sure, write a file with this PHP content:
可以肯定的是,用这个 PHP 内容编写一个文件:
<?php
phpInfo();
?>
and save it in your main MAMP document root (as any other web page) with name info.php
并使用名称将其保存在您的主 MAMP 文档根目录中(与任何其他网页一样) info.php
Open that file as a web URL in your browser as any other MAMP web page, as an example: http://127.0.0.1:8888/info.php
在浏览器中将该文件作为 Web URL 打开,就像任何其他 MAMP 网页一样,例如: http://127.0.0.1:8888/info.php
Search for the string: php.iniin that page.
php.ini在该页面中搜索字符串:。
You will find a line like this:
你会发现这样一行:
Configuration File (php.ini) Path /Applications/MAMP/bin/php/php7.2.8/conf
Configuration File (php.ini) Path /Applications/MAMP/bin/php/php7.2.8/conf
That line will show you the correct path for the ini file PHP is using in that moment. It depends on the PHP version you are using.
该行将向您显示 PHP 正在使用的 ini 文件的正确路径。这取决于您使用的 PHP 版本。
Delete (or rename with an unguessable name) the info.php file, after (avoid giving all this info to the world).
删除(或用不可猜测的名称重命名)info.php 文件,之后(避免向全世界提供所有这些信息)。
回答by Felipe M Andrada
MAMP PRO php config file is loaded from other path.
MAMP PRO php 配置文件是从其他路径加载的。
I found it after replace all php infos from mamp/bin/php/ directory without results.
我在替换 mamp/bin/php/ 目录中的所有 php 信息后发现它没有结果。
/Applications/MAMP PRO/MAMP PRO.app/Contents/Resources/php(VERSION).ini
回答by Erick Boileau
I have the same problem with MAMP (non pro), MAM is stopped the current php version I am using is php7.2.20, I have changed everywhere in /Applications/MAMP/bin/php/php7.2.20 and /Applications/MAMP/conf/php7.2.20
我对 MAMP(非专业版)有同样的问题,MAM 已停止,我使用的当前 php 版本是 php7.2.20,我在 /Applications/MAMP/bin/php/php7.2.20 和 /Applications/MAMP/ 中的所有地方都进行了更改conf/php7.2.20
post_max_size = 128M upload_max_filesize = 128M
post_max_size = 128M upload_max_filesize = 128M
I restart MAMP and I get php7.2.20 post_max_size = 8M upload_max_filesize = 32M
我重新启动 MAMP,我得到 php7.2.20 post_max_size = 8M upload_max_filesize = 32M
回答by Nick_Cash
On MACos make sure you are at the right path:
在MACos 上,请确保您在正确的位置path:
/Applications/MAMP/bin/php/phpx.x.x/conf/php.ini
/Applications/MAMP/bin/php/phpx.x.x/conf/php.ini
I see a lot of people had trouble with this since there is also another conf directory
我看到很多人都遇到了这个问题,因为还有另一个 conf 目录

