php 如何增加 cPanel 中的最大上传大小?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15868949/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to increase Maximum Upload size in cPanel?
提问by sana
I am using cPanel of my website to increase maximum upload file size for wordpress media uploads. I have used the codes(found out from google) for this purpose wp-config.php, .htaccess but nothing is working. In my cPanel, there is no service for php configuration editor under software / services section or anywhere else. Please help what should I do?
我正在使用我网站的 cPanel 来增加 wordpress 媒体上传的最大上传文件大小。为此,我使用了代码(从 google 中找到) wp-config.php, .htaccess 但没有任何效果。在我的 cPanel 中,在软件/服务部分或其他任何地方都没有针对 php 配置编辑器的服务。请帮忙我该怎么办?
My .htaccess shows this code:
我的 .htaccess 显示了这个代码:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I tried by placing the code:
我尝试通过放置代码:
php_value upload_max_filesize 20M
php_value post_max_size 20M
inside and outside # blocks, it gives 500 error rather.
在 # 块内部和外部,它会给出 500 错误。
采纳答案by sana
I have found the answer and solution to this problem. Before, I did not know that php.ini resides where in wordpress files. Now I have found that file in wp-admin directory where I placed the code
我已经找到了这个问题的答案和解决方案。之前,我不知道 php.ini 在 wordpress 文件中的位置。现在我在 wp-admin 目录中找到了我放置代码的文件
post_max_size 33M
upload_max_filesize 32M
then it worked. It increases the upload file size for my worpdress website. But, it is the same 2M as was before on cPanel.
然后它起作用了。它增加了我的 worpdress 网站的上传文件大小。但是,它与之前在 cPanel 上的 2M 相同。
回答by Sérgio
On cpanel -> software and services -> Select PHP Version.
在 cpanel -> software and services -> Select PHP Version.
Choose a PHP version which not the native one (I recommend php 5.6 or last one) and you will have / see a new link "Switch To PHP Settings", click it, in PHP Settings you can set upload_max_filesize in last line , clicking on value ( default is 2M ) , and you got a dropbox with values that you can set to upload_max_filesize, and click save .
选择一个不是本机版本的 PHP 版本(我推荐 php 5.6 或最后一个),您将拥有/看到一个新链接“切换到 PHP 设置”,单击它,在 PHP 设置中,您可以在最后一行设置 upload_max_filesize,单击值(默认为 2M ),您将获得一个带有可以设置为 upload_max_filesize 的值的保管箱,然后单击保存。
回答by Bravo Delta
Unfortunately, this is something you will have to ask you provider to do.
不幸的是,这是您必须要求您的提供商做的事情。
If your the owner of the server and can login to WHM it's under:
如果您是服务器的所有者并且可以登录 WHM,则它位于:
Tweak Settings => PHP Settings => Maximum Upload Size
Newer version have it listed under:
较新的版本将其列在:
Home => Service Configuration => PHP Configuration Editor => Tweak Settings => PHP
回答by Quentin
On CPanel 64.0.40 (I didn't try any other version): Go in "Software" then "Select PHP Version" then "Switch To PHP Options" then upload_max_filesize => click on the value and select the one you prefer :) It's super hidden for such a critical option...
在 CPanel 64.0.40 上(我没有尝试任何其他版本):进入“软件”然后“选择 PHP 版本”然后“切换到 PHP 选项”然后upload_max_filesize => 单击该值并选择您喜欢的那个:)对于这样一个关键选项,它是超级隐藏的......
回答by Step To Install
We can increase maximum upload file size for WordPress media uploads in 3different ways.
我们可以通过3种不同的方式增加 WordPress 媒体上传的最大上传文件大小。
That's are
那是
- .htaccess way
- PHP.INI file method
- Theme's Functions.php File
- .htaccess 方式
- PHP.INI文件方法
- 主题的 Functions.php 文件
For .htaccess way, add following code,
对于 .htaccess 方式,添加以下代码,
php_value upload_max_filesize 1024M
php_value post_max_size 1024M
php_value max_execution_time 1000
php_value max_input_time 1000
for PHP.INI file method, add following code,
对于 PHP.INI 文件方法,添加以下代码,
upload_max_filesize = 1024M
post_max_size = 1024M
max_execution_time = 1000
for Theme's Functions.php File, add following code,
对于 Theme 的 Functions.php 文件,添加以下代码,
@ini_set( ‘upload_max_size' , '1024M' );
@ini_set( ‘post_max_size', '1024M');
@ini_set( ‘max_execution_time', '1000′ );
回答by Quentin Dmello
Since there is no php.ini file in your /public_html directory......create a new file as phpinfo.php in /public_html directory
由于您的/public_html目录中没有php.ini文件......在/public_html目录中创建一个新文件作为phpinfo.php
-Type this code in phpinfo.php and save it:
- 在 phpinfo.php 中输入以下代码并保存:
<?php
phpinfo();
?>
<?php
phpinfo();
?>
-Then type yourdomain.com/phpinfo.php...you will see all the details of your configuration
- 然后输入 yourdomain.com/phpinfo.php...你会看到你的配置的所有细节
-To edit that config, create another file as php.ini in /public_html directory and paste this code:
memory_limit=512M
post_max_size=200M
upload_max_filesize=200M
- 要编辑该配置,请在 /public_html 目录中创建另一个文件作为 php.ini 并粘贴以下代码:
memory_limit=512M
post_max_size=200M
upload_max_filesize=200M
-And then refresh yourdomain.com/phpinfo.php and see the changes,it will be done.
-然后刷新 yourdomain.com/phpinfo.php 并查看更改,就完成了。
回答by Ananttah
Login to your WHM panel if you have access to
如果您有权访问,请登录您的 WHM 面板
Then go to Software -> MultiPHP INI Editor
然后转到软件-> MultiPHP INI 编辑器
Then select the php version from the dropdown, then scroll down for the upload_max_filesize which will be 2M by default, now increase it according to your need.
然后从下拉列表中选择php版本,然后向下滚动upload_max_filesize默认为2M,现在根据您的需要增加它。
Also enable the file_uploads for HTTP file uploads for convenience.
为方便起见,还为 HTTP 文件上传启用 file_uploads。
If you don't have access to WHM, then follow the .htaccess method.
如果您无权访问 WHM,请遵循 .htaccess 方法。
回答by DUzun
In my case it was wp-admin/.user.ini
:
就我而言,它是wp-admin/.user.ini
:
post_max_size = 33M
upload_max_filesize = 32M
回答by Connect Locals
New Cpanel Settings on a Godaddy
From Cpanel go to:
Godaddy 上的新 Cpanel 设置
从 Cpanel 转到:
- Software
- Select PHP version
- Click "Switch To PHP Options" located on upper right hand corner
- 软件
- 选择 PHP 版本
- 单击位于右上角的“切换到 PHP 选项”
Increase post max size and upload max file size, save and your done.
增加帖子最大大小并上传最大文件大小,保存并完成。
回答by Emmalex6250
The solution is to create the php.ini file under your root directory. If the site is the wordpress installation then create the php.ini under your/path/to/wordpress/wp-admin/php.ini and add the following line of codes
解决方法是在你的根目录下创建 php.ini 文件。如果站点是wordpress安装然后在您的/path/to/wordpress/wp-admin/php.ini下创建php.ini并添加以下代码行
[PHP]
post_max_size=120M
upload_max_filesize=132M