简体   繁体   English

php.ini upload_max_filesize 未更新

[英]php.ini upload_max_filesize not updating

I'm running CentOS 6.4.我正在运行 CentOS 6.4。 I've made changed to my php.ini file in the /etc folder.我已经更改了 /etc 文件夹中的 php.ini 文件。 I have changed the upload_max_filesize from 2M to 50M so it reads:我已将 upload_max_filesize 从 2M 更改为 50M,因此它显示为:

upload_max_filesize = 50M

I've also changed the post_max_size to 52M so it reads:我还将 post_max_size 更改为 52M,因此它显示为:

post_max_size = 52M

Now I have restarted Apache using both the service httpd restart command and the /sbin/service command but when I go into my root html directory in /var/www/html and open my test phpinfo() file the values for upload_max_filesize and post_max_filesize are still the default 2M and 8M values respectively.现在我已经使用 service httpd restart 命令和 /sbin/service 命令重新启动了 Apache,但是当我进入 /var/www/html 中的 html 根目录并打开我的测试 phpinfo() 文件时,upload_max_filesize 和 post_max_filesize 的值是仍然分别是默认的 2M 和 8M 值。

Have I missed something?我错过了什么吗?

我不得不这样做。

service php-fpm restart

The latest php versions doesn't allow direct php.ini changes.最新的 php 版本不允许直接更改 php.ini。

  1. Look for "Scan this dir for additional .ini files" directory in your phpinfo() output and create whatever-file-name.ini in this location.在 phpinfo() 输出中查找“Scan this dir for additional .ini files”目录,并在此位置创建whatever-file-name.ini。

  2. Put your custom variables in it.将您的自定义变量放入其中。

  3. Restart the webserver.重新启动网络服务器。

check the loading configuration file (php.ini) from the o/p of phpinfo().从 phpinfo() 的 o/p 检查加载配置文件 (php.ini)。 Make sure that you have made changes in the right configuration file (php.ini file)确保您在正确的配置文件(php.ini 文件)中进行了更改

I had the same problem.我有同样的问题。

The following changes fixed the issue.以下更改修复了该问题。

  1. Open phpinfo() and look for "Loaded Configuration File", this file should be updated.打开 phpinfo() 并查找“加载的配置文件”,该文件应该被更新。
  2. Update your php.ini file.更新您的 php.ini 文件。
  3. Kill "php-fpm" process杀死“php-fpm”进程

killall php-fpm

  1. Restart httpd重启httpd

systemctl restart httpd

I had this line uncommented, it needs to be commented Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED in php.ini我没有注释这一行,需要在 php.ini 中注释Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED

After that I could edit any value.之后我可以编辑任何值。 And of course restart your apache当然重启你的apache

在我的情况下sudo service apache2 restart应用了更改。

Check your php.ini file, don't have any errors.检查您的 php.ini 文件,没有任何错误。 php.ini don't set any configuration after error line. php.ini 在错误行后不要设置任何配置。

I have set the following values in .htaccess and it's working fine.我在 .htaccess 中设置了以下值,它工作正常。 (I wanted to upload 25 MB file) (我想上传 25 MB 的文件)

php_value post_max_size 30M
php_value upload_max_filesize 25M
php_value upload_max_size 25M

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

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