Maaz Zindani

Loading the index…

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

phpMyAdmin says it cannot start a session

ErrorCannot start session without errors

Short answer

phpMyAdmin keeps your login in a PHP session. If PHP cannot create or keep that session, you get this message or a login loop. Read the PHP error log first, then check three things: the session.save_path folder exists and is writable, session.cookie_secure matches how you open the site, and the URL phpMyAdmin thinks it has.

  • Applies to phpMyAdmin 5.2, PHP 8.3, 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 where it stores sessions, then read the web server's PHP error log for the line that names the real failure.

    php -i | grep -E '^session\.(save_path|cookie_secure)'
    sudo tail -n 30 /var/log/apache2/error.log
  2. 2Match what you see, then jump to its fix

    1. 1The error log shows a failure writing or opening a file under the session.save_path folderThe session folder is missing or PHP cannot write to itFix
    2. 2Login works on https:// but loops or fails on http://, and session.cookie_secure is 1Secure cookies are required but you open the site over HTTPFix
    3. 3The page loads, you log in, and you are sent back to the login page or see Missing parameters; the site sits behind a reverse proxyphpMyAdmin has the wrong idea of its own URL (proxy or HTTPS offload)Fix

What does the error look like?

  • Cannot start session without errors
  • Missing parameters

Cause 1 of 3

The session folder is missing or PHP cannot write to it

1Check

session.save_path is the folder where the default files handler creates session files. phpMyAdmin's FAQ lists a missing or unwritable folder as a cause of the 'Missing parameters' error. The PHP process must be able to write there.

php -i | grep '^session.save_path'
ls -ld /var/lib/php/sessions
ps -o user= -C apache2 | sort -u

2Fix

Create the folder if it is missing and give it to the user that runs PHP. Use the path your own session.save_path shows; the example is a common Debian and Ubuntu path.

sudo mkdir -p /var/lib/php/sessions
sudo chown www-data: /var/lib/php/sessions

3Verify

Reload the web server, open phpMyAdmin again and check that a session file appears.

sudo systemctl reload apache2
ls -l /var/lib/php/sessions | tail -n 3

Confirmed by docs.phpmyadmin.net

Did this fix it?

Cause 2 of 3

Secure cookies are required but you open the site over HTTP

1Check

With session.cookie_secure on, sessions only work over HTTPS. If you reach phpMyAdmin over plain HTTP, for example on an internal address, the cookie is never sent back.

php -i | grep '^session.cookie_secure'

2Fix

Open phpMyAdmin through HTTPS. Only if the server is not reachable from outside and you accept the trade-off, turn the setting off for that PHP pool.

; php.ini or pool config
session.cookie_secure = 1   ; keep on, and use https://

3Verify

Log in through the https:// address.

curl -sI https://example.com/phpmyadmin/ | head -n 5

Confirmed by php.net

Did this fix it?

Cause 3 of 3

phpMyAdmin has the wrong idea of its own URL (proxy or HTTPS offload)

1Check

phpMyAdmin's FAQ says repeated login prompts and Missing parameters can come from the $cfg['PmaAbsoluteUri'] setting not matching the URL users type. It also says a reverse proxy in front of Apache must rewrite Set-Cookie headers.

grep -n 'PmaAbsoluteUri' /etc/phpmyadmin/config.inc.php /var/www/html/phpmyadmin/config.inc.php

2Fix

Set PmaAbsoluteUri to the exact public address, and for an Apache reverse proxy add the cookie rewrite directives for domain and path.

// config.inc.php
$cfg['PmaAbsoluteUri'] = 'https://example.com/phpmyadmin/';

# Apache reverse proxy
ProxyPassReverseCookieDomain internal.example.local example.com
ProxyPassReverseCookiePath / /phpmyadmin/

3Verify

Log in again, then confirm that the browser stores a cookie for example.com.

sudo apachectl configtest && sudo systemctl reload apache2

Confirmed by docs.phpmyadmin.net

Did this fix it?

How do I stop it coming back?

  • After a PHP upgrade, check that session.save_path still exists and is owned correctly.
  • Use one public URL for phpMyAdmin and set it explicitly when a proxy is in the path.
  • Keep session.cookie_secure on and serve every admin tool over HTTPS.

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

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.