Bug #76651 [Com]: Can't establish a connection to MySQL after upgrading PHP from 7.2.7 to 7.2.8

From: Date: Sun, 22 Jul 2018 01:16:16 +0000
Subject: Bug #76651 [Com]: Can't establish a connection to MySQL after upgrading PHP from 7.2.7 to 7.2.8
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216388@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76651&edit=1

 ID:                 76651
 Comment by:         no at mail dot here
 Reported by:        itaylorswift365 at gmail dot com
 Summary:            Can't establish a connection to MySQL after
                     upgrading PHP from 7.2.7 to 7.2.8
 Status:             Open
 Type:               Bug
 Package:            MySQLi related
 Operating System:   Debian 9.5 x64
 PHP Version:        7.2.8
 Block user comment: N
 Private report:     N

 New Comment:

This bug also crops up on PHP 7.2.8 for Windows (x86 and x64). phpMyAdmin is affected as well.


Previous Comments:
------------------------------------------------------------------------
[2018-07-21 18:30:10] itaylorswift365 at gmail dot com

Everything is fine on PHP 7.2.7.

------------------------------------------------------------------------
[2018-07-21 18:26:51] itaylorswift365 at gmail dot com

Description:
------------
From PHP 7.2.0 to 7.2.7, everytime I compile and build PHP from source with this opinions:
./configure --enable-mysqlnd --with-mysqli=mysqlnd --with-mysql-sock=/tmp/mysql.sock
--with-pdo-mysql=mysqlnd {...} and everything looks fine. PHP can connect to MySQL successfully.

But this time I compiled PHP 7.2.8 with the same configure opinions, the compile and build process
was succeeded but after restarting php-fpm, I got an error that "MySQL Servr is Gone". But
MySQL process was still running out there, I was confused. So I wrote a PHP script to figure out
where the problem was. And I got this error "Connect DATABASE Error TYPE: 2002: Permission
denied". So I checked the socket file permission of both PHP and MySQL, I got this: php socket
file permission was 0660 while MySQL was 0777. And I made another test that if I downgrade PHP from
7.2.8 to 7.2.7, after restarting php-fpm, it could establish a successful connection to MySQL.
Running the same script got "Success: A proper connection to MySQL was made! The database is
great. Host information: Localhost via UNIX socket"

So running PHP 7.2.7 looks fine but there is a MySQL connection problem if running PHP 7.2.8.

(I use the default php.ini)

Test script:
---------------
<?php
$link = mysqli_connect("localhost", "user", "pass",
"dbname");

if (!$link) {
    echo "Error: Unable to connect to MySQL." . PHP_EOL;
    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
    exit;
}

echo "Success: A proper connection to MySQL was made! The database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;

mysqli_close($link);
?>

Expected result:
----------------
Success: A proper connection to MySQL was made! The my_db database is great. Host information:
Localhost via UNIX socket

Actual result:
--------------
Connect DATABASE Error TYPE: 2002: Permission denied


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=76651&edit=1


Thread (22 messages)

« previous php.bugs (#216388) next »