Edit report at https://bugs.php.net/bug.php?id=76651&edit=1
ID: 76651
User updated by: itaylorswift365 at gmail dot com
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: MySQL related
+Package: MySQLi related
Operating System: Debian 9.5 x64
PHP Version: 7.2.8
Block user comment: N
Private report: N
New Comment:
Everything is fine on PHP 7.2.7.
Previous Comments:
------------------------------------------------------------------------
[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