


WordPress Import 上传的文件尺寸超过php.ini中定义的upload_max_filesize值->解决办法
WordPress Import 上传的文件尺寸超过php.ini中定义的upload_max_filesize值-->解决方法。
参考一:
WordPress Importer上传导入备份文件时遇到这样一个错误,提示“上传的文件尺寸超过 php.ini 中定义的 upload_max_filesize 值”。问题原因是php.ini文件里限制了最大上传文件大小,默认为2MB,解决方法找到这个文件按照下文方法稍微修改一下即可。
以上为错误提示。解决方法先打开php.ini这个文件,具体路径大家自行找找,我这边没有在服务器上测试,使用的是XAMPP本地环境(xampp/php文件夹下),分别搜索upload_max_filesize = 2M和post_max_size = 8M,改一下文件上传最大限制,比如都改为40M,然后保存,重启一下apache服务。
修改后我们重新上传导入试试,这时应该就可以了,如下图,可上传更大文件。导入后,可以修改回原来的大小,记得重启一下apache服务。
可能一些使用虚拟主机的用户没有这个权限,也有一个变通方法。在导出WordPress XML备份文件时分批导出,比如按分类、标签、用户、时间分批导出,然后再逐个上传导入。另外目前也有一些XML文件分割软件,比如WordPress XML文件分割器、WXR File Splitter(这个可以自定义分割大小),使用也很方便。
参考二:
查找 post_max_size = 2M (默认为2M)改为想要的大小,如:
post_max_size = 100M
通常我们只做了这一步,以为就可以解决问题了。其实还需要看下面一步。
upload_max_filesize 表示所上传的文件的最大值。
查找upload_max_filesize,默认为8M改为
upload_max_filesize = 100M
需要注意的是,把post_max_size 大于 upload_max_filesize 的设置为好。
最后,设置结束后,需要重新启动apache。
具体可查看 PHP手册 中的 〔php.ini 核心配置选项说明〕
upload_max_filesize 所上传的文件的最大大小。
post_max_size 设定 POST 数据所允许的最大大小。
memory_limit 设定了一个脚本所能够申请到的最大内存字节数。
PHP上传文件涉及到的参数PHP默认的上传限定是最大2M,想上传超过此设定的文件,需要调整PHP、apache等的一些参数. 下面,我们简要介绍一下PHP文件上传涉及到的一些参数:
file_uploads
是否允许通过HTTP上传文件的开关,默认为ON即是开
upload_tmp_dir
upload_tmp_dir用来说明PHP上传的文件放置的临时目录,要想上传文件,得保证服务器没有关闭临时文件和有对文件夹的写权限,如果未指定则PHP使用系统默认值
upload_max_filesize
允许上传文件大小的最大值,默认为2M
post_max_size
控制在采用POST方法进行一次表单提交中PHP所能够接收的最大数据量。如果希望使用PHP文件上传功能,则需要将此值改为比upload_max_filesize要大
max_input_time
以秒为单位对通过POST、GET以及PUT方式接收数据时间进行限制。如果应用程序所运行环境处在低速链路上,则需要增加此值以适应接收数据所需的更多时间
memory_limit
为了避免正在运行的脚本大量使用系统可用内存,PHP允许定义内存使用限额。通过memory_limit变量来指定单个脚本程序可以使用的最大内存容量变量memory_limit的值应当适当大于post_max_size的值
max_execution_time
max_execution_time设置了在强制终止脚本前PHP等待脚本执行完毕的时间,此时间以秒计算。当脚本进入了一个无限循环状态时此变量非常有用。然而,当存在一个需要很长时间完成的合法活动时(例如上传大型文件),这项功能也会导致操作失败。在这样的情况下必须考虑将此变量值增加,以避免PHP在脚本正在执行某些重要过程的时候将脚本关闭
看来php.ini必须得弄清楚 里面的功能很强哦

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
