php / php/php-src

php hangs when auth_socket is set for the user

Open
#19,222 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Extension: mysqli Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php
$mysqli = new mysqli("localhost", "root", "...", "mysql");

echo $mysqli->host_info . "\n";

with a local MySQL 8.4 User like this:

*************************** 6. row ***************************
                    Host: localhost
                    User: root
...
                  plugin: auth_socket

Results in php hanging until MySQL timeouts instead of connecting to MySQL

Changing the auth plugin to caching_sha2_password solves the situation. I did not test what happens when I don't set the password or explicitly use the socket.

PHP Version
PHP 8.4.1 (cli) (built: Nov 25 2024 18:04:19) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.1, Copyright (c), by Zend Technologies
Operating System

Ubuntu 24.04

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the mysqli constructor example against MySQL 8.4 on Ubuntu 24.04 with the user configured for auth_socket, then compare it with caching_sha2_password and the explicitly mentioned socket and password variations. Trace the connection path until the hang occurs; done means the auth_socket case has a defined, non-hanging behavior or a confirmed fix with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.