WordPress的上传文件大小 [英] Wordpress upload file size
问题描述
我是菜鸟,正在Google云上使用Wordpress.尝试上传新主题时,出现以下错误消息:
I'm a noob and using Wordpress on Google cloud. When attempting to upload a new theme, I get the following error message:
上传的文件超出了
php.ini
中的upload_max_filesize
指令.
这似乎是由Google Compute Engine设置的限制.我已经找到关于在php.ini
文件中设置的限制的信息,但是我似乎无法在任何地方找到该文件.
This is a limitation seems to be set by Google Compute Engine. I've found info about the limitation being set in the php.ini
file, but I can't seem to locate that file anywhere.
任何人都可以提供一些白痴证明的逐步说明,以将上传大小增加到2MB以上吗?我已经安装了应该执行此操作的WP插件,但是问题必须出在服务器端.
Can anyone give some idiot proof, step-by-step instructions to increase the upload size beyond 2MB? I've installed the WP plug-ins that should do this, but the problem must be server side.
推荐答案
我不确定您使用的是哪种操作系统或使用的PHP版本.我使用PHP-FPM从Amazon Web Services运行Ubuntu 12.04实例.但是,说明应该基本上与您相同.在第3项中,保存php.ini文件的目录可能略有不同.
I'm not sure what operating system you are using or what version of PHP you are using. I run an Ubuntu 12.04 instance from Amazon Web Services using PHP-FPM. But, the instructions should be basically the same for you. The directory where your php.ini file is saved may be slightly different in item 3. Go hunt for it.
- 通过SSH登录到服务器.
- 将用户更改为root:
sudo /bin/bash
- 编辑php.ini文件:
nano /etc/php5/fpm/php.ini
- 找到显示
upload_max_filesize = 2M
的行.在nano中,您可以通过按Ctrl W进行搜索. - 更改为所需的文件大小无论键入什么内容,末尾都必须有M(兆字节)或G(千兆字节)(例如
upload_max_filesize = 200M
或=1G
).
- Log in to your server via SSH.
- Change user to root:
sudo /bin/bash
- Edit the php.ini file:
nano /etc/php5/fpm/php.ini
- Find the line that says
upload_max_filesize = 2M
. In nano, you can search by typing Ctrl W. - Change to whatever file size you want Whatever you type must have an M (megabytes) or G (gigabytes) at the end (e.g.
upload_max_filesize = 200M
or=1G
).
目标是您需要的最低数量,并请记住,PHP在其他地方有另一个设置,用于设置超时之前等待的时间.您可以设置2G的上传限制,但是如果您的超时时间是30秒,那么除非您可以在30秒内上传2G,否则您仍然会失败.通常,要低一点.
Aim for the lowest number that you NEED, and keep in mind that PHP has another setting elsewhere that sets how long it will wait before a timeout. You can set a 2G upload limit, but if your timeout is 30 seconds you're still going to fail unless you can upload 2G in 30 seconds. As a general rule, aim low.
- 输入Ctrl X退出,保存文件更改.
- 通过键入
service php5-fpm restart
重新启动PHP
- Type Ctrl X to exit, save your file changes.
- Restart PHP by typing
service php5-fpm restart
这篇关于WordPress的上传文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!