Wordpress php.ini文件设置upload_max_filesize以获得大约2MB的上传


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

我买了一个2.2M的模板,wordpress的限制设置为2M。

我正在托管服务器,因此我可以完全访问文件

  1. 我创建了一个info.php,发现:
    加载的配置文件:无

  2. 则设置php.ini不起作用:
    php.ini//和php5.ini
    上传_max_filesize=32Mpost_max_size=32M

  3. 还尝试设置:
    wp-config.phpdefine('WP_MMEMORY_LIMIT','64M');

  4. 也尝试过:
    无.htaccess文件

    • php_值post_max_size 30M
    • php_value upload_max_filesize 30M

我设法将文件复制到服务器上,但我很好奇
这一定是可能的,对吧?

如果您的主机允许您上传自定义的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

然后在wp-config中添加:

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

我已经在多台服务器上测试过了,如果它不起作用,是因为你的主机阻止了这个指令。