Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

You edited php.ini but phpMyAdmin still shows the old upload size

ErrorphpMyAdmin max upload size will not change

Short answer

PHP reads one main php.ini chosen per SAPI, plus extra .ini files from a scan directory. The command line and the web server can load different files. Ask the web server's PHP which files it loaded, edit that one, check the scan directory for an override, and restart the server.

  • Applies to PHP 8.3, PHP 8.4, Apache 2.4, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask PHP which files it loaded. Run this through the web server, not only the terminal: a one-line script placed in the web root prints the loaded files, then delete it.

    <?php
    var_dump(php_ini_loaded_file(), php_ini_scanned_files(), ini_get('upload_max_filesize'));
  2. 2Match what you see, then jump to its fix

    1. 1php --ini shows a different path than the web page doesYou edited the CLI php.ini, the web server loads anotherFix
    2. 2php_ini_scanned_files() lists .ini files and one of them sets the same directiveA file in the scan directory overrides your valueFix
    3. 3The file is right but the web page shows the old valueThe web server was not restartedFix

What does the error look like?

  • phpMyAdmin max upload size will not change
  • upload_max_filesize still reads 2M after you raised it in php.ini

Cause 1 of 3

You edited the CLI php.ini, the web server loads another

1Check

PHP looks for php-SAPI.ini first and then php.ini, and the path depends on the SAPI (Apache module, FPM, CLI). Each can have its own file.

php --ini

2Fix

Edit the file that the web page reports, not the one the terminal reports.

sudo nano /etc/php/8.3/apache2/php.ini

3Verify

Reload the one-line script and read the loaded file path again.

curl -s http://localhost/ini-check.php

Confirmed by php.net

Did this fix it?

Cause 2 of 3

A file in the scan directory overrides your value

1Check

After the main file, PHP loads every .ini file in the scan directory in alphabetical order, so a later file can win.

grep -R -n "upload_max_filesize" /etc/php/8.3/

2Fix

Change the directive in the file that sets it last, or remove the duplicate line.

; in the last file that sets it
upload_max_filesize = 64M
post_max_size = 64M

3Verify

Read the loaded values from the web.

curl -s http://localhost/ini-check.php

Confirmed by php.net

Did this fix it?

Cause 3 of 3

The web server was not restarted

1Check

For the server module versions of PHP, php.ini is read only once, when the web server starts. CGI and CLI read it on every run.

sudo systemctl status apache2

2Fix

Restart the web server (or PHP-FPM if you use it) after every change.

sudo systemctl restart apache2

3Verify

Open phpMyAdmin again and read the upload limit.

curl -s http://localhost/ini-check.php

Confirmed by php.net

Did this fix it?

How do I stop it coming back?

  • Always find the loaded file from the web server before editing.
  • Remove the check script after use.
  • Keep overrides in one scan-directory file so they are easy to find.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Databases

phpMyAdmin will not import a big SQL file

Import runs for a while, then the page stops or shows a blank result

phpMyAdmin hands the upload to PHP, so PHP's limits decide the maximum size.

4 causes, each with a fix

Back end

CodeIgniter 4 cannot write its cache files

CodeIgniter\Cache\Exceptions\CacheException: Cache unable to write to /var/www/app/writable/cache/

CodeIgniter 4's file cache needs a cache directory that the web server can really write to.

2 causes, each with a fix

Back end

CodeIgniter 3 loads the model but the property is undefined

The model name you are loading is the name of a resource that is already being used: user

CodeIgniter 3 expects a model file named like its class, with the first letter capitalised, for example User_model.php holding class User_model.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.