File Upload size decrease to 2mb ( initially was 80 mb) after increasing size to 500 mb

Keywords: Moodle - AWS - Technical issue - Other
Description:
Hi,

I was changing the maximum file upload size ( initially 80 mb in php.ini file as well as site security settings) but after I updated php.ini file in /opt/bitnami/php/etc/php.ini and set:
; Maximum size of POST data that PHP will accept.
post_max_size = 500M

; Maximum allowed size for uploaded files.
upload_max_filesize = 500M

my site got maximum upload to 2MB only… I revert the size back to 80M but it still showed me 2MB… I did not change anything else in my system… Just this file and restarted the server.
Can anybody please help

Thanks

Hello @ss235667,

I was able to get it updated by changing /opt/bitnami/php/etc/php.ini and checking it by accessing http://YOUR_IP/admin/phpinfo.php. Note that after the changes it is necessary to restart PHP-FPM:

sudo /opt/bitnami/ctlscript.sh restart php-fpm

I hope it helps

Hi David,

I did that and checked in php info… Its not updated there after updated Php.ini file and restarting fpm
I did apache restart as well but nothing happened… it was set 80mb before it reduced to 2mb.



@davidg can you please take a look…

Thanks

Hi @ss235667,

We have a Support Tool that will gather relevant information for us to analyze your configuration and logs. Could you please execute it on the machine where the stack is running by following the steps described in the guide below?

@davidg Thankyou very much for your reply…

here is the code:
af67984d-3706-1100-1563-36bf24ee5a6b

Hello @ss235667,

I can see those values are present in:

/opt/bitnami/php/etc/php.ini-development
/opt/bitnami/php/etc/php.ini-production 

Could you change them and retry it?

Regards

Thanks @davidg for your valuable time. I updated the values in both the files… restarted fpm, restarted apache but still showing me 2mb.

here is latest code ID:
e349ded6-b4f8-299b-4ab8-a99392fcac55

Hello @ss235667,

I suppose you restarted PHP-FPM after the latest change.

Note you need to restart PHP-FPM:

sudo /opt/bitnami/ctlscript.sh restart php-fpm

You can also restart all the services

sudo /opt/bitnami/ctlscript.sh restart

The issue is really weird, and it is difficult to find it since the support tool does not gather all the files. Please try restarting all the services. If that does not work, you can use ag to try to find where this value is set in your installation.

sudo su
apt install -y silversearcher-ag
cd /opt/bitnami
ag --hidden post_max_size | grep 8M
ag --hidden upload_max_filesize | grep 2M

Regards

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

Thanks @davidg

I have run these commands… I got nothing with --hidden upload_max_filesize | grep 2M
but I got follwing after: --hidden upload_max_filesize

I changed bnsupport/original-data/php/etc/php.ini file as well to change it to 100M and restarted fpm and server but still nothing… After that I changed 80:export PHP_DEFAULT_UPLOAD_MAX_FILESIZE="80M to 100M in scripts/phpmyadmin-env.sh
still it did not solve…

I am totally lost now as such a simple variable change is just being turned into a big issue.

Here are the outputs of ag:

bnsupport/original-data/php/etc/php.ini
841:upload_max_filesize = 80M
1940:upload_max_filesize = 80M

php/etc/php.ini
841:upload_max_filesize = 100M

php/etc/php.ini-production
841:upload_max_filesize = 100M

php/etc/php.ini-development
839:upload_max_filesize = 100M

php/include/php/main/php_globals.h
88: zend_long upload_max_filesize;

phpmyadmin/doc/html/_sources/faq.rst.txt
169:of max_execution_time, upload_max_filesize, memory_limit and
173:upload_max_filesize. There exist several workarounds if your upload is too

phpmyadmin/doc/html/faq.html
158:of max_execution_time, upload_max_filesize, memory_limit and
162:upload_max_filesize. There exist several workarounds if your upload is too

phpmyadmin/libraries/classes/File.php
304: 'The uploaded file exceeds the upload_max_filesize directive in '

phpmyadmin/libraries/classes/Config.php
1316: if (! $filesize = ini_get('upload_max_filesize')) {

scripts/php-env.sh
22: PHP_UPLOAD_MAX_FILESIZE
66:export PHP_UPLOAD_MAX_FILESIZE="${PHP_UPLOAD_MAX_FILESIZE:-}"

scripts/phpmyadmin-env.sh
80:export PHP_DEFAULT_UPLOAD_MAX_FILESIZE="80M" # only used at build time

scripts/phpmyadmin/postunpack.sh
52:php_conf_set upload_max_filesize "$PHP_DEFAULT_UPLOAD_MAX_FILESIZE"

scripts/libphp.sh
59: ! is_empty_value "$PHP_UPLOAD_MAX_FILESIZE" && info "Setting PHP upload_max_filesize option" && php_conf_set upload_max_filesize "$PHP_UPLOAD_MAX_FILESIZE"

689:post_max_size = 100M
1941:post_max_size = 100M

php/etc/php.ini
689:post_max_size = 100M

php/etc/php.ini-production
689:post_max_size = 100M

php/etc/php.ini-development
687:post_max_size = 100M

php/include/php/main/SAPI.h
128: zend_long post_max_size;

phpmyadmin/doc/html/_sources/faq.rst.txt
170:post_max_size in the :file:php.ini configuration file. All of these
172:PHP. Please note that post_max_size needs to be larger than

phpmyadmin/doc/html/faq.html
159:post_max_size in the php.ini configuration file. All of these
161:PHP. Please note that post_max_size needs to be larger than

phpmyadmin/libraries/classes/Config.php
1320: if ($postsize = ini_get('post_max_size')) {

scripts/php-env.sh
23: PHP_POST_MAX_SIZE
67:export PHP_POST_MAX_SIZE="${PHP_POST_MAX_SIZE:-}"

scripts/phpmyadmin-env.sh
81:export PHP_DEFAULT_POST_MAX_SIZE="100M" # only used at build time

scripts/phpmyadmin/postunpack.sh
53:php_conf_set post_max_size "$PHP_DEFAULT_POST_MAX_SIZE"

scripts/libphp.sh
60: ! is_empty_value "$PHP_POST_MAX_SIZE" && info "Setting PHP post_max_size option" && php_conf_set post_max_size "$PHP_POST_MAX_SIZE"

Hello @ss235667,

Let’s try a different approach. It worked for me on a clean installation.

  • Add this line at the end of your /opt/bitnami/php/etc/php-fpm.conf
php_admin_value[upload_max_filesize] = 513M

After that, restart php-fpm:

sudo /opt/bitnami/ctlscript.sh restart php-fpm

If you need to debug it, you can change log_level = warning to log_level = debug in your /opt/bitnami/php/etc/php-fpm.conf, restart php-fpm, and execute:

/opt/bitnami/php/sbin/php-fpm --pid /opt/bitnami/php/var/run/php-fpm.pid --fpm-config /opt/bitnami/php/etc/php-fpm.conf --prefix /opt/bitnami/php -c /opt/bitnami/php/etc/php.ini -tt

Regards

Thanks @davidg

I changed this configuration as you suggested and my 2mb file upload changed to 8mb… I have attached debug report here:

[25-Mar-2021 15:13:49.238249] NOTICE: pid 8084, fpm_conf_dump(), line 1611: [global]
[25-Mar-2021 15:13:49.238387] NOTICE: pid 8084, fpm_conf_dump(), line 1612: 	pid = /opt/bitnami/php/var/run/php-fpm.pid
[25-Mar-2021 15:13:49.238523] NOTICE: pid 8084, fpm_conf_dump(), line 1613: 	error_log = /opt/bitnami/php/logs/php-fpm.log
[25-Mar-2021 15:13:49.238647] NOTICE: pid 8084, fpm_conf_dump(), line 1615: 	syslog.ident = php-fpm
[25-Mar-2021 15:13:49.238774] NOTICE: pid 8084, fpm_conf_dump(), line 1616: 	syslog.facility = 24
[25-Mar-2021 15:13:49.238869] NOTICE: pid 8084, fpm_conf_dump(), line 1618: 	log_buffering = yes
[25-Mar-2021 15:13:49.238948] NOTICE: pid 8084, fpm_conf_dump(), line 1619: 	log_level = DEBUG
[25-Mar-2021 15:13:49.239025] NOTICE: pid 8084, fpm_conf_dump(), line 1620: 	log_limit = 1024
[25-Mar-2021 15:13:49.239101] NOTICE: pid 8084, fpm_conf_dump(), line 1621: 	emergency_restart_interval = 0s
[25-Mar-2021 15:13:49.239178] NOTICE: pid 8084, fpm_conf_dump(), line 1622: 	emergency_restart_threshold = 0
[25-Mar-2021 15:13:49.239262] NOTICE: pid 8084, fpm_conf_dump(), line 1623: 	process_control_timeout = 0s
[25-Mar-2021 15:13:49.239340] NOTICE: pid 8084, fpm_conf_dump(), line 1624: 	process.max = 0
[25-Mar-2021 15:13:49.239417] NOTICE: pid 8084, fpm_conf_dump(), line 1626: 	process.priority = undefined
[25-Mar-2021 15:13:49.239493] NOTICE: pid 8084, fpm_conf_dump(), line 1630: 	daemonize = yes
[25-Mar-2021 15:13:49.239569] NOTICE: pid 8084, fpm_conf_dump(), line 1631: 	rlimit_files = 0
[25-Mar-2021 15:13:49.239645] NOTICE: pid 8084, fpm_conf_dump(), line 1632: 	rlimit_core = 0
[25-Mar-2021 15:13:49.239722] NOTICE: pid 8084, fpm_conf_dump(), line 1633: 	events.mechanism = epoll
[25-Mar-2021 15:13:49.239799] NOTICE: pid 8084, fpm_conf_dump(), line 1637:  
[25-Mar-2021 15:13:49.239843] NOTICE: pid 8084, fpm_conf_dump(), line 1642: [www]
[25-Mar-2021 15:13:49.239888] NOTICE: pid 8084, fpm_conf_dump(), line 1643: 	prefix = undefined
[25-Mar-2021 15:13:49.239964] NOTICE: pid 8084, fpm_conf_dump(), line 1644: 	user = daemon
[25-Mar-2021 15:13:49.240041] NOTICE: pid 8084, fpm_conf_dump(), line 1645: 	group = daemon
[25-Mar-2021 15:13:49.240117] NOTICE: pid 8084, fpm_conf_dump(), line 1646: 	listen = /opt/bitnami/php/var/run/www.sock
[25-Mar-2021 15:13:49.240194] NOTICE: pid 8084, fpm_conf_dump(), line 1647: 	listen.backlog = 511
[25-Mar-2021 15:13:49.240271] NOTICE: pid 8084, fpm_conf_dump(), line 1652: 	listen.owner = daemon
[25-Mar-2021 15:13:49.240347] NOTICE: pid 8084, fpm_conf_dump(), line 1653: 	listen.group = daemon
[25-Mar-2021 15:13:49.240424] NOTICE: pid 8084, fpm_conf_dump(), line 1654: 	listen.mode = undefined
[25-Mar-2021 15:13:49.240521] NOTICE: pid 8084, fpm_conf_dump(), line 1655: 	listen.allowed_clients = 127.0.0.1
[25-Mar-2021 15:13:49.240607] NOTICE: pid 8084, fpm_conf_dump(), line 1657: 	process.priority = undefined
[25-Mar-2021 15:13:49.240697] NOTICE: pid 8084, fpm_conf_dump(), line 1661: 	process.dumpable = no
[25-Mar-2021 15:13:49.240775] NOTICE: pid 8084, fpm_conf_dump(), line 1662: 	pm = dynamic
[25-Mar-2021 15:13:49.240852] NOTICE: pid 8084, fpm_conf_dump(), line 1663: 	pm.max_children = 15
[25-Mar-2021 15:13:49.240928] NOTICE: pid 8084, fpm_conf_dump(), line 1664: 	pm.start_servers = 10
[25-Mar-2021 15:13:49.241005] NOTICE: pid 8084, fpm_conf_dump(), line 1665: 	pm.min_spare_servers = 10
[25-Mar-2021 15:13:49.241081] NOTICE: pid 8084, fpm_conf_dump(), line 1666: 	pm.max_spare_servers = 10
[25-Mar-2021 15:13:49.241158] NOTICE: pid 8084, fpm_conf_dump(), line 1667: 	pm.process_idle_timeout = 10
[25-Mar-2021 15:13:49.241235] NOTICE: pid 8084, fpm_conf_dump(), line 1668: 	pm.max_requests = 5000
[25-Mar-2021 15:13:49.241312] NOTICE: pid 8084, fpm_conf_dump(), line 1669: 	pm.status_path = undefined
[25-Mar-2021 15:13:49.241389] NOTICE: pid 8084, fpm_conf_dump(), line 1670: 	ping.path = undefined
[25-Mar-2021 15:13:49.241466] NOTICE: pid 8084, fpm_conf_dump(), line 1671: 	ping.response = undefined
[25-Mar-2021 15:13:49.241542] NOTICE: pid 8084, fpm_conf_dump(), line 1672: 	access.log = undefined
[25-Mar-2021 15:13:49.241619] NOTICE: pid 8084, fpm_conf_dump(), line 1673: 	access.format = undefined
[25-Mar-2021 15:13:49.241698] NOTICE: pid 8084, fpm_conf_dump(), line 1674: 	slowlog = undefined
[25-Mar-2021 15:13:49.241775] NOTICE: pid 8084, fpm_conf_dump(), line 1675: 	request_slowlog_timeout = 0s
[25-Mar-2021 15:13:49.241852] NOTICE: pid 8084, fpm_conf_dump(), line 1676: 	request_slowlog_trace_depth = 20
[25-Mar-2021 15:13:49.241928] NOTICE: pid 8084, fpm_conf_dump(), line 1677: 	request_terminate_timeout = 0s
[25-Mar-2021 15:13:49.242010] NOTICE: pid 8084, fpm_conf_dump(), line 1678: 	request_terminate_timeout_track_finished = no
[25-Mar-2021 15:13:49.242088] NOTICE: pid 8084, fpm_conf_dump(), line 1679: 	rlimit_files = 0
[25-Mar-2021 15:13:49.242165] NOTICE: pid 8084, fpm_conf_dump(), line 1680: 	rlimit_core = 0
[25-Mar-2021 15:13:49.242241] NOTICE: pid 8084, fpm_conf_dump(), line 1681: 	chroot = undefined
[25-Mar-2021 15:13:49.242318] NOTICE: pid 8084, fpm_conf_dump(), line 1682: 	chdir = undefined
[25-Mar-2021 15:13:49.242395] NOTICE: pid 8084, fpm_conf_dump(), line 1683: 	catch_workers_output = no
[25-Mar-2021 15:13:49.242471] NOTICE: pid 8084, fpm_conf_dump(), line 1684: 	decorate_workers_output = yes
[25-Mar-2021 15:13:49.242548] NOTICE: pid 8084, fpm_conf_dump(), line 1685: 	clear_env = yes
[25-Mar-2021 15:13:49.242624] NOTICE: pid 8084, fpm_conf_dump(), line 1686: 	security.limit_extensions = .php .phar
[25-Mar-2021 15:13:49.242707] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[PHP_PATH] = $PHP_PATH
[25-Mar-2021 15:13:49.242784] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[FREETDSLOCALES] = $FREETDSLOCALES
[25-Mar-2021 15:13:49.242861] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[FREETDSCONF] = $FREETDSCONF
[25-Mar-2021 15:13:49.242938] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[OPENSSL_ENGINES] = $OPENSSL_ENGINES
[25-Mar-2021 15:13:49.243015] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[OPENSSL_CONF] = $OPENSSL_CONF
[25-Mar-2021 15:13:49.243091] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[SSL_CERT_FILE] = $SSL_CERT_FILE
[25-Mar-2021 15:13:49.243168] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[CURL_CA_BUNDLE] = $CURL_CA_BUNDLE
[25-Mar-2021 15:13:49.243245] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[LDAPCONF] = $LDAPCONF
[25-Mar-2021 15:13:49.243321] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[GS_LIB] = $GS_LIB
[25-Mar-2021 15:13:49.243391] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[MAGICK_CODER_MODULE_PATH] = $MAGICK_CODER_MODULE_PATH
[25-Mar-2021 15:13:49.243408] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[MAGICK_CONFIGURE_PATH] = $MAGICK_CONFIGURE_PATH
[25-Mar-2021 15:13:49.243440] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[MAGICK_HOME] = $MAGICK_HOME
[25-Mar-2021 15:13:49.243478] NOTICE: pid 8084, fpm_conf_dump(), line 1689: 	env[PATH] = $PATH
[25-Mar-2021 15:13:49.243493] NOTICE: pid 8084, fpm_conf_dump(), line 1697: 	php_admin_value[upload_max_filesize] = 513M
[25-Mar-2021 15:13:49.243525] NOTICE: pid 8084, fpm_conf_dump(), line 1699:  
[25-Mar-2021 15:13:49.243537] NOTICE: pid 8084, fpm_conf_init_main(), line 1758: configuration file /opt/bitnami/php/etc/php-fpm.conf test is successful

Hello @ss235667,

I can see PHP-FPM is properly loading the new value (I suggested 513M as an example, but feel free to change it as you consider). So it should also change the value for your Moodle installation. you can confirm it by accessing http://YOUR_IP/admin/phpinfo.php.

Regards