The uploaded file exceeds the upload_max_filesize directive

第2步:编辑PHP配置文件

运行以下命令以打开文件。

sudo vi /etc/php/7.0/cli/php.ini

找到下面的行,并根据需求修改:

file_uploads = On
upload_max_filesize = 100M
memory_limit = 256M
post_max_size = 32M
max_execution_time = 600
max_input_time = 900

上面的设置设置以下参数:

  • file_uploads =文件上载将启用
  • upload_max_filesize =可以上传的最大文件大小
  • memory_limit =脚本可以消耗的内存量
  • max_execution_time =允许在终止之前运行脚本的最长时间

保存PHP文件后,重新启动Web服务器

问题

WordPress上传文件报错

‘The uploaded file exceeds the upload_max_filesize directive in php.ini’
xcontent exceeds the maximum upload size for this site

'上载的文件超过了php.ini中的upload_max_filesize指令'
xcontent超出了此站点的最大上载大小

第1步:找到PHP配置文件

找出PHP默认配置文件。
配置文件包含控制PHP如何处理基本操作的所有指令。

php --ini

输出示例:

Configuration File (php.ini) Path: /etc/php/7.0/cli
Loaded Configuration File:         /etc/php/7.0/cli/php.ini
Scan for additional .ini files in: /etc/php/7.0/cli/conf.d
日期:2020-07-07 20:54:46 来源:oir作者:oir