英文:
Self-hosted WordPress and unable to successfully adjust the upload_max_filesize
问题
I copied the latest wordpress onto a Linode ubuntu 20.04 server using cURL and was able to deploy it live with apache2 and custom DNS, but have been unable to upload a PRO plugin due to PHP upload_max_filesize issue:
I ran php --ini
on the server and here is the output:
Configuration File (php.ini) Path: /etc/php/7.4/cli Loaded Configuration File: /etc/php/7.4/cli/php.ini Scan for additional .ini files in: /etc/php/7.4/cli/conf.d Additional .ini files parsed: /etc/php/7.4/cli/conf.d/10-mysqlnd.ini, /etc/php/7.4/cli/conf.d/10-opcache.ini, /etc/php/7.4/cli/conf.d/10-pdo.ini, /etc/php/7.4/cli/conf.d/15-xml.ini, /etc/php/7.4/cli/conf.d/20-bcmath.ini, /etc/php/7.4/cli/conf.d/20-calendar.ini, /etc/php/7.4/cli/conf.d/20-ctype.ini, /etc/php/7.4/cli/conf.d/20-curl.ini, /etc/php/7.4/cli/conf.d/20-dom.ini, /etc/php/7.4/cli/conf.d/20-exif.ini, /etc/php/7.4/cli/conf.d/20-ffi.ini, /etc/php/7.4/cli/conf.d/20-fileinfo.ini, /etc/php/7.4/cli/conf.d/20-ftp.ini, /etc/php/7.4/cli/conf.d/20-gd.ini, /etc/php/7.4/cli/conf.d/20-gettext.ini, /etc/php/7.4/cli/conf.d/20-iconv.ini, /etc/php/7.4/cli/conf.d/20-igbinary.ini, /etc/php/7.4/cli/conf.d/20-json.ini, /etc/php/7.4/cli/conf.d/20-mbstring.ini, /etc/php/7.4/cli/conf.d/20-msgpack.ini, /etc/php/7.4/cli/conf.d/20-mysqli.ini, /etc/php/7.4/cli/conf.d/20-pdo_mysql.ini, /etc/php/7.4/cli/conf.d/20-phar.ini, /etc/php/7.4/cli/conf.d/20-posix.ini, /etc/php/7.4/cli/conf.d/20-readline.ini, /etc/php/7.4/cli/conf.d/20-shmop.ini, /etc/php/7.4/cli/conf.d/20-simplexml.ini, /etc/php/7.4/cli/conf.d/20-sockets.ini, /etc/php/7.4/cli/conf.d/20-sysvmsg.ini, /etc/php/7.4/cli/conf.d/20-sysvsem.ini, /etc/php/7.4/cli/conf.d/20-sysvshm.ini, /etc/php/7.4/cli/conf.d/20-tokenizer.ini, /etc/php/7.4/cli/conf.d/20-xmlreader.ini, /etc/php/7.4/cli/conf.d/20-xmlwriter.ini, /etc/php/7.4/cli/conf.d/20-xsl.ini, /etc/php/7.4/cli/conf.d/20-zip.ini, /etc/php/7.4/cli/conf.d/25-memcached.ini
In /etc/php/7.4/cli/php.ini
, I updated upload_max_filesize (higher and higher all the way up to 512M) and post_max_size
and restarted apache, but still hitting the same error. Also added the Upload filesize plugin and set that pretty high as well:
At this point I'm wide open to ideas on how this can be resolved. The error message seems pretty cut and dry.
I also attempted to add @ini_set('upload_max_size' , '256M' );
to the wp-config.php to no avail and created a test.php file that echoes the value of upload_max_filesize, which does echo as expected.
英文:
I copied the latest wordpress onto a Linode ubuntu 20.04 server using cURL and was able to deploy it live with apache2 and custom DNS, but have been unable to upload a PRO plugin due to PHP upload_max_filesize issue:
I ran php --ini
on the server and here is the output:
Configuration File (php.ini) Path: /etc/php/7.4/cli
Loaded Configuration File: /etc/php/7.4/cli/php.ini
Scan for additional .ini files in: /etc/php/7.4/cli/conf.d
Additional .ini files parsed: /etc/php/7.4/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.4/cli/conf.d/10-opcache.ini,
/etc/php/7.4/cli/conf.d/10-pdo.ini,
/etc/php/7.4/cli/conf.d/15-xml.ini,
/etc/php/7.4/cli/conf.d/20-bcmath.ini,
/etc/php/7.4/cli/conf.d/20-calendar.ini,
/etc/php/7.4/cli/conf.d/20-ctype.ini,
/etc/php/7.4/cli/conf.d/20-curl.ini,
/etc/php/7.4/cli/conf.d/20-dom.ini,
/etc/php/7.4/cli/conf.d/20-exif.ini,
/etc/php/7.4/cli/conf.d/20-ffi.ini,
/etc/php/7.4/cli/conf.d/20-fileinfo.ini,
/etc/php/7.4/cli/conf.d/20-ftp.ini,
/etc/php/7.4/cli/conf.d/20-gd.ini,
/etc/php/7.4/cli/conf.d/20-gettext.ini,
/etc/php/7.4/cli/conf.d/20-iconv.ini,
/etc/php/7.4/cli/conf.d/20-igbinary.ini,
/etc/php/7.4/cli/conf.d/20-json.ini,
/etc/php/7.4/cli/conf.d/20-mbstring.ini,
/etc/php/7.4/cli/conf.d/20-msgpack.ini,
/etc/php/7.4/cli/conf.d/20-mysqli.ini,
/etc/php/7.4/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.4/cli/conf.d/20-phar.ini,
/etc/php/7.4/cli/conf.d/20-posix.ini,
/etc/php/7.4/cli/conf.d/20-readline.ini,
/etc/php/7.4/cli/conf.d/20-shmop.ini,
/etc/php/7.4/cli/conf.d/20-simplexml.ini,
/etc/php/7.4/cli/conf.d/20-sockets.ini,
/etc/php/7.4/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.4/cli/conf.d/20-sysvsem.ini,
/etc/php/7.4/cli/conf.d/20-sysvshm.ini,
/etc/php/7.4/cli/conf.d/20-tokenizer.ini,
/etc/php/7.4/cli/conf.d/20-xmlreader.ini,
/etc/php/7.4/cli/conf.d/20-xmlwriter.ini,
/etc/php/7.4/cli/conf.d/20-xsl.ini,
/etc/php/7.4/cli/conf.d/20-zip.ini,
/etc/php/7.4/cli/conf.d/25-memcached.ini
In /etc/php/7.4/cli/php.ini
, I updated upload_max_filesize (higher and higher all the way up to 512M) and post_max_size
and restarted apache, but still hitting the same error. Also added the Upload filesize plugin and set that pretty high as well:
At this point I'm wide open to ideas on how this can be resolved. The error message seems pretty cut and dry.
I also attempted to add @ini_set('upload_max_size' , '256M' );
to the wp-config.php to no avail and created a test.php file that echoes the value of upload_max_filesize, which does echo as expected.
答案1
得分: 2
以下是已翻译的内容:
根据模块的不同,将使用哪个ini文件。您需要编辑这些配置文件以获得更广泛的兼容性:
/etc/php/7.4/apache2/php.ini
/etc/php/7.4/cgi/php.ini
/etc/php/7.4/cli/php.ini
或者,您可以创建一个user.ini
文件。
此外,您至少需要编辑:
memory_limit
max_post_size
upload_max_filesize
其中memory_limit
的值 > max_post_size
>= upload_max_filesize
。例如,您可以设置值为10MB、8MB、6MB或8MB。
请注意:上述答案适用于使用MOD PHP的设置。有关MPM Event与PHP-FPM所需的说明,请阅读我的博客文章。
英文:
Which ini file will be used that depends on the module. You need to edit these configuration files for a wider compatibility:
/etc/php/7.4/apache2/php.ini
/etc/php/7.4/cgi/php.ini
/etc/php/7.4/cli/php.ini
Alternatively, you can create an user.ini
file.
Also, you have to edit at least:
memory_limit
max_post_size
upload_max_filesize
Where value of memory_limit
> max_post_size
>= upload_max_filesize
. For example, you can set the values 10MB, 8MB, 6MB or 8MB.
Please Note: The above answer is for the setup with MOD PHP. Please read my blog article for the required instructions for MPM Event with PHP-FPM.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论