mysql database connection, No such file or directory error

Solution:
1, to determine the problem mysqli_connect () and mysqli_pconnect (), the function returns failure phenomenon is empty, but mysqli_error () returns "No such file or directory".
2, write a phpinfo page, find mysql.default_socket, mysqli.default_socket, pdo_mysql.default_socket.

3, start mysql, Run STATUS; note the value of the UNIX socket.
4, 2 and 3 if the value is not the same, then the open php.ini (can be found from a position php.ini phpinfo page, the default is /private/etc/php.ini), arranged in the three mentioned 2 change the value of the item value of 3.

After the restart php-fpm problem solving

Guess you like

Origin www.cnblogs.com/petersonx/p/11037616.html