Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Fix phpMyAdmin by identifying which of three independent connections is failing: the browser to Nginx over HTTPS, Nginx to PHP-FPM over FastCGI, or PHP/phpMyAdmin to MySQL or MariaDB. A valid certificate proves only that the first layer can negotiate TLS; it does not prove that PHP-FPM is running, that the right PHP modules are loaded, or that the database accepts the account.

Use the exact error message to choose the first check. A 502 points to FastCGI, a missing mysqli message points to the PHP-FPM runtime, error 2002 usually points to a socket or database listener, and “Access denied” points to credentials, grants, host matching, or an authentication plugin. Work through the layers in that order and change one setting at a time.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand the three connections before changing configuration

“phpMyAdmin is not connecting” can describe failures at different layers. Separating them prevents a certificate change from being used to chase a database password problem.

Hop What it does Typical symptoms What proves it works
Browser → Nginx (HTTPS) Terminates TLS, selects the HTTPS virtual host, and serves or proxies the request. Certificate warning, connection refused, timeout, redirect loop, wrong site, or HTTP/HTTPS switching. The intended certificate and hostname appear, and a request reaches the expected Nginx server block.
Nginx → PHP-FPM (FastCGI) Sends the phpMyAdmin PHP script to the PHP-FPM socket or TCP listener. 502 Bad Gateway, downloaded PHP source, blank response, or a PHP error page. A small PHP file in the same location executes through the same FPM pool.
PHP/phpMyAdmin → MySQL or MariaDB Uses mysqli, a socket or TCP endpoint, and database authentication. “mysqli extension is missing,” socket error 2002, “connection refused,” “Access denied,” or an authentication-plugin error. The same account and endpoint work with a database client from the server.

phpMyAdmin’s interface runs in a browser, so a web server such as Nginx is required to deliver its files. The PHP runtime used by Nginx must also load mysqli, the connector phpMyAdmin uses for MySQL and MariaDB. The command-line PHP binary can be a different version or configuration and therefore cannot, by itself, prove that FPM has the extension.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.

Classify the exact symptom

Copy the complete message, including an error number, before editing a file. Use this table to select the narrowest next test.

Visible result Likely layer First check
TLS warning, refused port 443, timeout, or redirect loop Nginx, DNS, firewall, or certificate DNS, port 443 reachability, certificate hostname/chain, and the HTTPS listen/server_name block.
502 Bad Gateway FastCGI/PHP-FPM The fastcgi_pass target, FPM service state, and whether the socket belongs to the installed PHP version.
Page loads but says mysqli is missing PHP-FPM extensions Loaded modules in FPM, not only php -m from the shell; install or enable the matching mysqli package and reload FPM.
“Can’t connect to local MySQL server through socket” or error 2002 Database socket/listener The actual socket path, database service status, and whether phpMyAdmin is trying a local socket when the server is elsewhere.
“Connection refused” to a host or port Database TCP listener or firewall Listening address/port, firewall rules, and the host and port in config.inc.php.
“Access denied for user” Credentials or account grants Username, password, user@host matching, and grants.
Authentication method or plugin not supported Client/server authentication compatibility The account’s authentication plugin and the mysqli client library loaded by FPM.
phpMyAdmin redirects to HTTP or generates the wrong hostname Proxy or URL construction Forwarded HTTPS handling, the active HTTPS server block, and PmaAbsoluteUri when a reverse proxy is involved.

Verify the HTTPS Nginx virtual host

Confirm DNS, port 443, and certificate identity

Resolve the hostname to the intended server and confirm that a firewall or cloud security group allows TCP 443. The certificate’s names must include the hostname in the URL; a certificate for a different name is a browser-layer failure, not a phpMyAdmin database failure. Check that the HTTPS server block contains the expected listen 443 ssl directive and matching server_name. If several blocks exist, an incorrect default block can serve a valid certificate and site for the wrong hostname.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Route phpMyAdmin through the HTTPS block

The HTTPS block should use the same phpMyAdmin document root and PHP location as the working installation. A minimal pattern is:

server {
    listen 443 ssl;
    server_name db.example.test;
    root /var/www/phpmyadmin;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ .php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php/php-fpm.sock;
    }
}

The socket name above is an example pattern, not a universal path. Use the socket created by the PHP-FPM service actually installed on your system. Validate before reloading with nginx -t, then reload Nginx only after the test succeeds.

Separate redirects from database errors

Keep one canonical public URL. If a reverse proxy or load balancer terminates TLS before Nginx, ensure the proxy forwards the original host and HTTPS state and that Nginx trusts those headers only from the proxy. phpMyAdmin’s current configuration guidance marks ForceSSL as deprecated. Reverse-proxy deployments may need PmaAbsoluteUri set to the externally visible URL so generated links and redirects do not fall back to HTTP. Do not use a URL workaround to hide a failing PHP or database layer.

Run a small PHP execution test

Before diagnosing MySQL, create a temporary file in the same Nginx location, for example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
<?php
header('Content-Type: text/plain');
echo "php-okn";
echo PHP_VERSION . "n";
?>

Request it over the same HTTPS hostname. Delete it immediately after the test because any PHP information file can reveal server details. If it fails, stay in the Nginx/FPM section; phpMyAdmin cannot connect until ordinary PHP executes.

Fix a 502 Bad Gateway between Nginx and PHP-FPM

Check the live FPM service and listener

Inspect the service status and logs for the FPM pool used by Nginx. On systemd systems, list installed pools with:

systemctl list-units --type=service 'php*-fpm.service'
systemctl status <the-active-php-fpm-service>

Use the service name shown on your host for subsequent commands. A stopped service, a crash loop, or a permission error opening the socket produces 502 responses even when HTTPS is perfect.

Make fastcgi_pass match the real socket or port

Compare the Nginx fastcgi_pass value with the FPM pool’s listen value. Common mismatches include an old versioned socket left in Nginx after a PHP upgrade, a socket moved from /run, or a pool listening on TCP while Nginx expects a Unix socket. Check that the socket exists and that the Nginx worker can access it. If the pool uses TCP, verify that the address and port are reachable locally and not already occupied.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify the script filename

In the PHP location, SCRIPT_FILENAME must resolve to the actual phpMyAdmin file. A wrong document root can produce “Primary script unknown” in the FPM log or a 404-like response. Keep the parameter consistent with the installation path and avoid accepting arbitrary user-supplied script paths.

Reload in the correct order

  1. Fix the pool or Nginx setting and run nginx -t.
  2. Restart or reload the affected PHP-FPM service so its configuration and modules are loaded.
  3. Reload Nginx.
  4. Request the small PHP test again, then request phpMyAdmin and record any changed message.

Do not restart unrelated services while testing; a single controlled change makes the next log entry meaningful.

Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Make sure the FPM runtime has mysqli

Why php -m can mislead you

php -m reports modules for the command-line SAPI. Nginx normally hands requests to PHP-FPM, which may use another PHP version, another php.ini, or a different extension directory. It is possible for the shell to show mysqli while phpMyAdmin reports that it is missing.

Inspect FPM, not only the CLI

Use the temporary PHP test to display PHP_SAPI and the loaded modules, or inspect the FPM binary and pool configuration used by the active service. The result must show an FPM SAPI and the mysqli module. Install or enable the mysqli package corresponding to that FPM PHP version using your operating system’s package manager, then restart FPM and reload Nginx. A module enabled for an older PHP version does not automatically load in the newer pool.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check dependent client libraries

After mysqli appears, a plugin error can still indicate that the underlying MySQL client library is too old for the account’s authentication method. Resolve that as an authentication-compatibility issue rather than repeatedly reinstalling phpMyAdmin. Confirm the client library and account plugin together in the database section.

Correct the MySQL or MariaDB endpoint

Understand Unix sockets

A Unix socket is a local filesystem endpoint. It works only when the database server runs on the same machine as PHP. In config.inc.php, inspect the server’s host, port, and socket settings:

$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '/run/mysqld/mysqld.sock';

The path above is only an example. Determine the real socket from the database server configuration or the database client’s status output. A stale path causes error 2002 even when MySQL is running. Also verify that the PHP-FPM user can access the socket’s directory and file.

Use TCP deliberately

When the database is remote, a socket cannot work. Set an explicit database hostname and port. For a database on the same host, 127.0.0.1 forces TCP instead of the special local-socket behavior that many clients apply to localhost:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

Use the actual listener port if it is not 3306. Confirm that MySQL or MariaDB listens on the selected address, that a firewall permits the connection, and that the account is granted for that host. Do not switch socket, host, port, and credentials simultaneously; change one endpoint variable, reload the relevant service, and capture the new error.

Test from the same server

Run the database client on the server using the same host, port, username, and database account that phpMyAdmin uses. A successful test proves network reachability and server-side authentication for that endpoint; it does not prove that FPM loaded the same client library. A failed test gives a more precise database error than the browser page and should be fixed before returning to phpMyAdmin.

Resolve credentials, host grants, and authentication plugins

Check the complete account identity

MySQL accounts are identified by both user and host. An account granted as 'admin'@'localhost' is not the same as 'admin'@'127.0.0.1' or 'admin'@'web-server.example'. Match the host value produced by phpMyAdmin’s endpoint choice, then verify the password and required grants. A correct password for the wrong host entry still produces “Access denied.”

Test the exact credentials safely

Use the database client interactively so the password is not exposed in shell history. Specify the same hostname or IP that appears in config.inc.php. If the client succeeds only with a different host spelling, align phpMyAdmin’s host setting or create the appropriate host grant according to your security policy. Avoid granting broad remote access merely to make a test pass.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Handle unsupported authentication methods

If the server requests an authentication method that the mysqli client does not support, identify the account’s authentication plugin and the client library used by FPM. Prefer upgrading the PHP/MySQL client stack when possible. Changing an account’s plugin is a security-sensitive database operation: schedule it, verify compatibility for every application using that account, and test with least-privilege credentials. Do not disable authentication checks or replace a strong plugin with a weaker one as a quick fix.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep browser HTTPS separate from MySQL SSL

What browser HTTPS protects

Browser HTTPS terminates at Nginx or an upstream proxy. It protects the browser-to-proxy connection and validates the web certificate and hostname. It says nothing about the connection from PHP to MySQL.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

What MySQL SSL protects

MySQL or MariaDB SSL encrypts the PHP-to-database connection, especially important when the database is remote. phpMyAdmin configures this under the server entry, using options such as a CA certificate, client certificate, client key, and verification settings:

$cfg['Servers'][$i]['ssl'] = true;
$cfg['Servers'][$i]['ssl_ca'] = '/etc/ssl/db/ca.pem';
$cfg['Servers'][$i]['ssl_cert'] = '/etc/ssl/db/client-cert.pem';
$cfg['Servers'][$i]['ssl_key'] = '/etc/ssl/db/client-key.pem';
$cfg['Servers'][$i]['ssl_verify'] = true;

Use paths readable by the FPM process but not publicly served. Encryption alone does not authenticate the database server; a trusted CA and verification establish that trust. Setting ssl_verify to false disables server-certificate verification. Treat that as a deliberate, temporary exception with a documented risk, never as the general solution to a certificate or connection error.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagnose the right certificate

A browser certificate warning belongs to Nginx or the proxy. A MySQL certificate or TLS handshake error appears only after PHP reaches the database and belongs to the database SSL settings, CA chain, client credentials, or server TLS policy. Fix the layer that emits the error instead of copying web-server certificates into the database configuration without a matching trust model.

Use logs in the order the request travels

  1. Browser developer tools: inspect the request URL, redirect chain, status code, and TLS error.
  2. Nginx access and error logs: look for the selected server block, upstream connection failures, permission errors, and “primary script unknown.”
  3. PHP-FPM logs: check pool startup, socket permissions, fatal PHP errors, missing modules, and client-library messages.
  4. phpMyAdmin/application logs: correlate the displayed database error with the request time.
  5. MySQL or MariaDB logs: check rejected accounts, TLS negotiation, bind addresses, and server startup or socket errors.

phpMyAdmin’s setup documentation notes that its syslog destination is not the same file as an Apache or Nginx web-server log. Reading only Nginx’s log can therefore miss the database-side reason. Record timestamps in UTC or in the server’s configured timezone so entries from each layer can be matched.

Choose the smallest safe fix

Failure layer Preferred change Operational risk Verification
HTTPS/Nginx Correct DNS, certificate chain, server_name, redirect, or proxy headers. May affect every site on the virtual host. Canonical HTTPS URL, correct certificate, no loop, expected access-log entry.
PHP-FPM Point fastcgi_pass to the live listener, fix script path, enable mysqli, and reload only affected services. Reloading the wrong pool can interrupt other PHP applications. Temporary PHP test executes and exposes the expected FPM version/modules.
Database endpoint Correct one socket, host, port, or connection-type setting. Changing to TCP may expose a listener to a network if firewall policy is wrong. Database client succeeds with the same endpoint from the server.
Authentication Correct password, host grant, or compatible plugin. Grant or plugin changes can affect other applications and security posture. Least-privilege account logs in through the same host and client library.
MySQL SSL Install the correct CA/client files and enable verification appropriate to the server certificate. Disabling verification creates a man-in-the-middle risk. Database TLS succeeds and the server certificate validates against the intended CA.

Special case: HTTP/3 and missing host information

If the site uses HTTP/3 and hostname-dependent behavior is wrong even though ordinary HTTPS works, inspect the variables passed from Nginx to FPM. phpMyAdmin’s current FAQ identifies a missing HTTP_HOST variable in some Nginx HTTP/3 configurations. Add this parameter inside the relevant PHP-FPM location or server block:

fastcgi_param HTTP_HOST $host;

Test the configuration, reload Nginx, and reproduce the hostname-specific problem. This setting addresses URL/host detection; it does not repair a dead FPM socket, missing mysqli module, wrong password, or unavailable database.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recovery checklist

  • Copy the exact browser or phpMyAdmin error and note its time.
  • Confirm the request reaches the intended HTTPS Nginx server block and certificate.
  • Run and remove a temporary PHP test in the same location.
  • Verify the active PHP-FPM service, socket or TCP listener, script filename, and socket permissions.
  • Confirm that FPM, not just CLI PHP, loads mysqli.
  • Choose either the real local socket or an explicit TCP host and port; do not mix them accidentally.
  • Test the same endpoint and account with the database client from the server.
  • Check the account’s user@host, password, grants, and authentication plugin.
  • Configure MySQL SSL separately from browser HTTPS, and keep certificate verification enabled unless a documented exception is unavoidable.
  • Read Nginx, FPM, phpMyAdmin, and database logs in request order after each single change.

Once the small PHP test, the database-client test, and the browser request all succeed independently, phpMyAdmin has all three prerequisites: a reachable HTTPS site, a functioning FPM runtime with mysqli, and an accepted database connection.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.