How to connect a socket to the database?

Hello, I two days, can't make Pichu with the database through the socket.
Desktop Ubuntu 16.04, nginx, php7.0-fmp, php7.0-mysql

I did the following:
in the config database added skip-networking and bind-address 127.0.0.1
in the script, changed the host on the path, and set the argument to socket 1.

Error HY000 - 2002 php_network_getaddresses: getaddrinfo failed: Name or service not known

Another interesting point, if the host specify localhost, it will be no such file, although /etc/hosts everything is spelled out
July 9th 19 at 10:49
1 answer
July 9th 19 at 10:51
Solution
Code in Studio
What do you want? Configs al scripts?
In mysql, is inscribed:
skip-networking

as well
socket=/var/run/mysqld/mysqld.sock
and
bind-address 127.0.0.1

PHP:
= mysqli_connect($host=path/to/sock,
$user,
$pass,
$port=3306,
$socket=1);

Libraries for mysql 7.0 is installed.

In php.ini added mysql.default.socket=/path/

Tcp port to communicate normally. The right standard for www-data
php with nginx is tightened so:

location unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /path/to/index.php; - dejon_Schaden12 commented on July 9th 19 at 10:54
: mysqli_connect(localhost
$user,
$pass,
$port=3306,
path/to/sock) - bailee_Stant commented on July 9th 19 at 10:57
Thank you. - dejon_Schaden12 commented on July 9th 19 at 11:00

Find more questions by tags * nix-like systemsPHPUbuntuMySQL