PHP mysqli_get_client_info() Function

Beginner
5 min read
Updated: Nov 2026
3 examples
MySQLi

Definition

In PHP, mysqli_get_client_info() returns a string describing the MySQL client library version that PHP is using. The procedural call works without an open connection.

You can also read it from a connection with $mysqli->client_info in object style. Use this when diagnosing which client library your PHP build linked against.

Syntax

Call mysqli_get_client_info() with the values you need. Start with this line.

PHP
$info = mysqli_get_client_info();
CallWhat it does
mysqli_get_client_info()Returns the client library version string with no connection needed.
$mysqli->client_infoOO property that exposes the same client info on a connection.
echo mysqli_get_client_info();Prints the version string for debugging.

No database server is required for the procedural function. The string often looks like a version number such as 8.0.36 or a mysqlnd build identity, depending on how PHP was compiled.

Library declarations
PHP
mysqli_get_client_info(): string

Parameters

ParameterDescription
—The common procedural form takes no parameters.

Return Value

Return ValueDescription
stringThe MySQL client library version information.

PHP Examples

Example 1 — Print Client Info Without Connecting

Call mysqli_get_client_info() alone and print a typical sample string.

PHP
<?php
echo mysqli_get_client_info(), PHP_EOL;

How It Works

  1. No mysqli_connect() call is needed.
  2. mysqli_get_client_info() reads the linked client library.
  3. A typical mysqlnd sample string is printed.
  4. Your exact string depends on the PHP build.

Example 2 — Compare with a Connection Property

Connect and show that the OO client_info property matches the procedural call in a sample.

PHP
<?php
$procedural = mysqli_get_client_info();
$mysqli = mysqli_connect("localhost", "demo", "secret", "shop");

echo $procedural, PHP_EOL;
echo $mysqli->client_info, PHP_EOL;

mysqli_close($mysqli);

How It Works

  1. The procedural call runs before connect.
  2. After connect, client_info is read from the object.
  3. Both lines show the same sample client string.
  4. The connection is closed when finished.

Example 3 — Prefix a Debug Line

Include client info in a short diagnostic message for logs.

PHP
<?php
$info = mysqli_get_client_info();
echo "mysqli client: ", $info, PHP_EOL;

How It Works

  1. Store the version string in $info.
  2. Prefix it with a clear label.
  3. Print one diagnostic line.
  4. Useful when comparing environments.

Frequently Asked Questions

It returns a string with the MySQL client library version used by PHP. The procedural form does not need a connection.
Not for the procedural mysqli_get_client_info() call. It works without a connection.
Read $mysqli->client_info on a mysqli object, or use related client properties after constructing a connection.
No. Client info is the library linked into PHP. Server version comes from mysqli_get_server_info() after connecting.
Many PHP builds use mysqlnd (MySQL Native Driver). The info string identifies that client implementation and version.

Next: mysqli_get_client_stats()

mysqli_get_client_stats() returns an associative array of client-side performance counters.

mysqli_get_client_stats() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful