简体   繁体   English

php.ini 更改时上传最大文件大小不变

[英]Upload Max File Size not changing when php.ini is changed

So, I've basically tried everything possible to change the upload max filesize limit on my wordpress website with no results.所以,我基本上已经尝试了一切可能的方法来更改我的 wordpress 网站上的上传最大文件大小限制,但没有任何结果。

I created a whole new Amazon Linux 2 AMI instance in AWS and followed their tutorial to download Wordpress and set everything up.我在 AWS 中创建了一个全新的 Amazon Linux 2 AMI 实例,并按照他们的教程下载 Wordpress 并设置所有内容。 ( https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html ). https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html )。 I also moved my Domain from NameCheap to AWS using Route 53.我还使用 Route 53 将我的域从 NameCheap 移动到 AWS。

After that, I wanted to migrate a website from another domain to this one, but in order to do that, I have to upload a file larger than 2M.之后,我想将一个网站从另一个域迁移到这个域,但是为了做到这一点,我必须上传一个大于 2M 的文件。

So, I ssh'd into my instance and changed the following php.ini file settings to:因此,我 ssh 进入我的实例并将以下 php.ini 文件设置更改为:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

The php.ini file I changed is the one that is being loaded and is shown when running我更改的 php.ini 文件是正在加载并在运行时显示的文件

php --ini

This changed my upload file size limit from 2M to 1M in the Add New Media section in Wordpress.这将我在 Wordpress 的“添加新媒体”部分中的上传文件大小限制从 2M 更改为 1M。 I then looked into the functions.php file in the theme twentytwenty folder (This theme comes with the WordPress installation).然后我查看了主题 2020 文件夹中的 functions.php 文件(此主题随附 WordPress 安装)。

There was no override to these settings to I added them myself, but again, no results, so I removed them again.我自己添加了这些设置,但没有覆盖这些设置,但同样没有结果,所以我再次删除了它们。

Lastly, I added the following to my .htaccess file:最后,我在 .htaccess 文件中添加了以下内容:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

But this just crashed the website.但这只是使网站崩溃。

After each of these changes I was restarting the httpd, mariadb and php-fpm services with sudo...在每一项更改之后,我都使用 sudo 重新启动 httpd、mariadb 和 php-fpm 服务...

I am running out of options.. Does anyone have any other ideas?我的选择已经不多了。有没有人有其他想法?

EDIT: When I see the phpinfo.php file that I added on the website, the settings are updated.编辑:当我看到我在网站上添加的 phpinfo.php 文件时,设置更新。 It's just not showing in wordpress.它只是没有显示在 wordpress 中。

Have you tried to restart your php-fpm with:您是否尝试过使用以下命令重新启动php-fpm

systemctl restart php-fpm.service

or或者

service php-fpm restart

On CentOS8 you will need to在 CentOS8 上,您需要

  1. Edit php.ini编辑 php.ini
  2. Restart php-fpm systemctl restart php-fpm重启 php-fpm systemctl restart php-fpm
  3. Restart httpd systemctl restart httpd重启 httpd systemctl restart httpd
  4. for file uploading problems add MAX_FILE_SIZE to html pages对于文件上传问题,将 MAX_FILE_SIZE 添加到 html 页面

If you have a multisite there is also an option for the max upload file size in the multisite network settings https://www.cloudways.com/blog/increase-media-file-maximum-upload-size-in-wordpress/如果您有一个多站点,那么在多站点网络设置https://www.cloudways.com/blog/increase-media-file-maximum-upload-size-in-wordpress/中还有一个最大上传文件大小的选项

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

相关问题 在php.ini上更改upload_max_filesize后,PHP文件的上传大小受到限制 - PHP file upload size is limited after changing upload_max_filesize on php.ini PHPMyAdmin最大上传大小不会更改,错误的php.ini文件 - PHPMyAdmin max upload size will not change, wrong php.ini file WordPress忽略php.ini上传最大文件大小 - WordPress ignoring php.ini upload max file size 大型文件上传,无需更改php.ini - Large size file upload without changing php.ini php.ini文件中的upload_max_filesize更改,但ini_get仍显示2M - upload_max_filesize changed in php.ini file, but ini_get still shows 2M 上传超过 1MB 的任何内容时 php.ini 不允许即使更改 post_max_size、upload_max_filesize 和 memory_limit AWS - When uploading anything over 1MB php.ini does not allow even when changed post_max_size, upload_max_filesize and memory_limit AWS php.ini max_upload_file大小恢复为默认的2M - php.ini max_upload_file size falling back to default 2M 在php.ini中更改文件上传限制大小后,仍然不起作用 - after changing the file upload limit size in php.ini, still doesn't work 设置php.ini max_file_size问题。 - Setting php.ini max_file_size issue. php.ini中的最大上传限制文件大小 - Maximum upload limit file size in the php.ini
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM