phpMyAdmin stops with a wrong-permissions message about config.inc.php
Wrong permissions on configuration file, should not be world writable!Short answer
phpMyAdmin checks that config.inc.php cannot be written by everyone and stops if it can. Find the real file, then remove write access for others, for example with chmod 660. Switch the check off with CheckConfigurationPermissions only when the file sits on a filesystem that cannot hold Unix permissions.
Fix it fast
1Find out which cause you have
Show the permissions of the config file phpMyAdmin loads. On Debian and Ubuntu packages it lives in /etc/phpmyadmin; in a downloaded copy it is in the top folder.
ls -l /etc/phpmyadmin/config.inc.php /var/www/html/phpmyadmin/config.inc.php2Match what you see, then jump to its fix
What does the error look like?
Wrong permissions on configuration file, should not be world writable!
Cause 1 of 2
The file really is writable by every user
1Check
Look at the mode string. Three groups of letters follow the dash: owner, group, others. A w in the third group is what phpMyAdmin rejects. Unzipping with a loose umask, or an earlier chmod 777, leaves it this way.
stat -c '%a %U:%G %n' /etc/phpmyadmin/config.inc.php2Fix
Take write access away from others. The phpMyAdmin FAQ suggests 660 for this file; use the path your check showed.
sudo chmod 660 /etc/phpmyadmin/config.inc.php3Verify
Reload the phpMyAdmin page. The mode now ends in 0 and the login screen appears. The web server user must still be able to read the file through its owner or group.
stat -c '%a %U:%G %n' /etc/phpmyadmin/config.inc.phpConfirmed by docs.phpmyadmin.net
Cause 2 of 2
The files sit on a drive that cannot show real permissions
1Check
phpMyAdmin can be installed on an NTFS volume mounted on a non-Windows server. Such mounts report permissions that look wrong and cannot be told apart from real ones, so the check misfires.
findmnt -T /var/www/html/phpmyadmin2Fix
If the mount really cannot store Unix permissions, set the documented option to false in config.inc.php. Do not use this on a normal ext4 or xfs disk, where fixing the mode is the right answer.
<?php
$cfg['CheckConfigurationPermissions'] = false;3Verify
Reload phpMyAdmin; the message is gone.
curl -sI http://localhost/phpmyadmin/ | head -n 1Confirmed by docs.phpmyadmin.net
How do I stop it coming back?
- Never use chmod -R 777 on a web root to get past a permission problem.
- Keep config.inc.php readable only by the web server user and its owner.
- After unpacking a new phpMyAdmin release, check the mode of the config file before opening it in a browser.
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
Servers
Apache returns 504 Gateway Timeout when PHP takes too long
Quick requests work, slow ones end in a 504 after a fixed wait
A 504 from Apache means the backend did not answer within the proxy timeout.
2 causes, each with a fixServers
Composer reports a different PHP version than php -v on Ubuntu
You are running 8.1.2.
Composer takes its PHP version from the interpreter that runs it, unless config.platform fakes one.
3 causes, each with a fixServers
docker-php-ext-install mbstring fails: oniguruma not found
The docker-php-ext-install step exits with a non-zero code
mbstring needs the Oniguruma library to build its regex functions, and the PHP build finds it through pkg-config.
3 causes, each with a fixServers
Laravel returns 500 Internal Server Error on Apache
/var/www/html/.htaccess: RewriteCond: bad flag delimiters
Apache and Laravel report different 500s.
5 causes, each with a fixServers
nginx gives up waiting for the app and returns 504
upstream timed out (110: Connection timed out) while reading response header from upstream
nginx returns 504 when the app behind it takes the request but sends nothing back within proxy_read_timeout (60 seconds by default), or when the connection cannot be opened in time.
5 causes, each with a fixServers
nginx and PHP-FPM show File not found or Primary script unknown
File not found.
PHP-FPM received a script path it could not turn into a file.
4 causes, each with a fix