简体   繁体   English

Wordpress php.ini文件将upload_max_filesize设置为大约2MB上传

[英]Wordpress php.ini file to set upload_max_filesize to get around 2MB upload

I bought a template 2.2M and the limit on wordpress is set to 2M. 我买了一个2.2M的模板,wordpress的限制设置为2M。

I am hosting the server so I have full access to files. 我托管服务器,因此可以完全访问文件。

  1. I have created a info.php and found: 我创建了一个info.php并发现:
    Loaded configuration file: none 加载的配置文件:无

  2. Then setting php.ini is not working: 然后设置php.ini不起作用:
    php.ini // and php5.ini php.ini //和php5.ini
    upload_max_filesize = 32M post_max_size = 32M upload_max_filesize = 32M post_max_size = 32M

  3. Also tried to set: 还尝试设置:
    wp-config.php define('WP_MEMORY_LIMIT', '64M'); wp-config.php define('WP_MEMORY_LIMIT','64M');

  4. Also tried: 还尝试了:
    No .htaccess file 没有.htaccess文件

    • php_value post_max_size 30M php_value post_max_size 30M
    • php_value upload_max_filesize 30M php_value upload_max_filesize 30M

I anded with coping the file to the server, but I am curious; 我将文件处理到服务器,但是很好奇。
It must be possible, right? 一定有可能吧?

If your hosting allows you to upload a custom php.ini file, just create it at /wp-admin folder. 如果您的托管允许您上传自定义php.ini文件,只需在/ wp-admin文件夹中创建它即可。

upload_max_filesize=280M ;Max file size
max_execution_time=600 ; Script's max execution time, if it's short the file won't upload
memory_limit=1024M ; Memory limit, mine is high because i execute some script when uploading
post_max_size=280M ;Max POST size, it should be the same size as the file size limit

Then at wp-config add: 然后在wp-config添加:

define(’WP_MEMORY_LIMIT’, ’64M’);

I've tested this in multiple servers, if it doesn't work is because your hosting blocks this directives. 我已经在多台服务器上对此进行了测试,如果它不起作用是因为您的主机阻止了该指令。

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

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