简体   繁体   English

如何使用 .htaccess 在 WordPress 中增加最大上传文件大小

[英]How to increase maximum upload file size in WordPress using .htaccess

How to increase maximum upload file size in WordPress using .htaccess?如何使用 .htaccess 增加 WordPress 中的最大上传文件大小?

Been trying to increase the max upload file size in WordPress.一直在尝试增加 WordPress 中的最大上传文件大小。 Tried changing php in cPanel but couldn't get that to work.尝试在 cPanel 中更改 php,但无法使其正常工作。 Tried typing this code into the .htaccess editor plugin:尝试将此代码输入到 .htaccess 编辑器插件中:

php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300

but it keeps telling me syntax error.但它一直告诉我语法错误。 I'm placing it after the #END WordPress line too.我也将它放在#END WordPress 行之后。

You can also use ini_set in wp_config.php您也可以在 wp_config.php 中使用ini_set

ini_set('upload_max_filesize', '128M');
ini_set(' post_max_size', '128M');
.htaccess
php_value upload_max_filesize 64M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300

Functions.php
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

php.ini put on root directory where your .htaccess located
upload_max_filesize = 25M
post_max_size = 13M
memory_limit = 15M

wp-config.php
@ini_set( 'upload_max_size' , '20M' );
@ini_set( 'post_max_size', '13M');
@ini_set( 'memory_limit', '15M' );

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM