Example 1 — Print Host Info After Connect
Connect to a local demo server and print a typical host info string.
<?php
$mysqli = mysqli_connect("localhost", "demo", "secret", "shop");
echo mysqli_get_host_info($mysqli), PHP_EOL;
mysqli_close($mysqli); How It Works
- mysqli_connect() opens the demo link.
- mysqli_get_host_info() describes that link.
- The sample shows a UNIX socket connection to localhost.
- TCP setups print a via TCP/IP style message instead.

