In PHP, mysqli_get_server_info() returns the MySQL server version as a human-readable string for the open connection, such as "8.0.36".
Use it when you want a printable version for logs, admin pages or debugging. For a numeric form you can compare in code, prefer mysqli_get_server_version().
Syntax
Call mysqli_get_server_info() with the values you need. Start with this line.
PHP
$version = mysqli_get_server_info($mysqli);
Call
What it does
mysqli_get_server_info($mysqli)
Returns a string like "8.0.36" for the connected server.
echo mysqli_get_server_info($mysqli)
Prints the server version text to the browser or terminal.
$info = mysqli_get_server_info($mysqli);
Stores the version string so you can log or display it later.
You need a live connection from mysqli_connect(), new mysqli() or mysqli_init() plus mysqli_real_connect(). The string format depends on the server build; do not parse it with fragile string logic when you only need a number.
Library declarations
PHP
mysqli_get_server_info(mysqli $mysql): string
Parameters
Parameter
Description
mysql
Required. The mysqli connection returned by mysqli_connect() or mysqli_init().
Return Value
Return Value
Description
string
The MySQL server version as text, for example "8.0.36" or "5.7.44-log".
PHP Examples
Example 1 — Print the Server Version String
Connect with placeholders and print the server info string. The output is a fixed sample.