wp_check_php_mysql_versions

The timeline below displays how wordpress function wp_check_php_mysql_versions has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.4

/**
 * Checks for the required PHP version, and the mysqli extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = PHP_VERSION;
    if (version_compare($required_php_version, $php_version, '>')) {
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        printf('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.', $php_version, $wp_version, $required_php_version);
        exit(1);
    }
    // This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet.
    $wp_content_dir = defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : (ABSPATH . 'wp-content');
    if (!function_exists('mysqli_connect') && !file_exists($wp_content_dir . '/db.php')) {
        require_once ABSPATH . WPINC . '/functions.php';
        wp_load_translations_early();
        $message = '<p>' . __('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.') . "</p>\n";
        $message .= '<p>' . sprintf(
            /* translators: %s: mysqli. */
            __('Please check that the %s PHP extension is installed and enabled.'),
            '<code>mysqli</code>'
        ) . "</p>\n";
        $message .= '<p>' . sprintf(
            /* translators: %s: Support forums URL. */
            __('If you are unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href="%s">WordPress support forums</a>.'),
            __('https://wordpress.org/support/forums/')
        ) . "</p>\n";
        $args = array('exit' => false, 'code' => 'mysql_not_found');
        wp_die($message, __('Requirements Not Met'), $args);
        exit(1);
    }
}

WordPress Version: 6.3

/**
 * Checks for the required PHP version, and the MySQL extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = PHP_VERSION;
    if (version_compare($required_php_version, $php_version, '>')) {
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        printf('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.', $php_version, $wp_version, $required_php_version);
        exit(1);
    }
    // This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet.
    $wp_content_dir = defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : (ABSPATH . 'wp-content');
    if (!function_exists('mysqli_connect') && !function_exists('mysql_connect') && !file_exists($wp_content_dir . '/db.php')) {
        require_once ABSPATH . WPINC . '/functions.php';
        wp_load_translations_early();
        $message = '<p>' . __('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.') . "</p>\n";
        $message .= '<p>' . sprintf(
            /* translators: %s: mysqli. */
            __('Please check that the %s PHP extension is installed and enabled.'),
            '<code>mysqli</code>'
        ) . "</p>\n";
        $message .= '<p>' . sprintf(
            /* translators: %s: Support forums URL. */
            __('If you are unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href="%s">WordPress support forums</a>.'),
            __('https://wordpress.org/support/forums/')
        ) . "</p>\n";
        $args = array('exit' => false, 'code' => 'mysql_not_found');
        wp_die($message, __('Requirements Not Met'), $args);
        exit(1);
    }
}

WordPress Version: 6.2

/**
 * Check for the required PHP version, and the MySQL extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = PHP_VERSION;
    if (version_compare($required_php_version, $php_version, '>')) {
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        printf('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.', $php_version, $wp_version, $required_php_version);
        exit(1);
    }
    if (!function_exists('mysqli_connect') && !function_exists('mysql_connect') && (defined('WP_CONTENT_DIR') && !file_exists(WP_CONTENT_DIR . '/db.php') || !file_exists(ABSPATH . 'wp-content/db.php'))) {
        require_once ABSPATH . WPINC . '/functions.php';
        wp_load_translations_early();
        $message = '<p>' . __('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.') . "</p>\n";
        $message .= '<p>' . sprintf(
            /* translators: %s: mysqli. */
            __('Please check that the %s PHP extension is installed and enabled.'),
            '<code>mysqli</code>'
        ) . "</p>\n";
        $message .= '<p>' . sprintf(
            /* translators: %s: Support forums URL. */
            __('If you are unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href="%s">WordPress support forums</a>.'),
            __('https://wordpress.org/support/forums/')
        ) . "</p>\n";
        $args = array('exit' => false, 'code' => 'mysql_not_found');
        wp_die($message, __('Requirements Not Met'), $args);
        exit(1);
    }
}

WordPress Version: 6.1

/**
 * Check for the required PHP version, and the MySQL extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = PHP_VERSION;
    if (version_compare($required_php_version, $php_version, '>')) {
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        printf('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.', $php_version, $wp_version, $required_php_version);
        exit(1);
    }
    if (!extension_loaded('mysql') && !extension_loaded('mysqli') && !extension_loaded('mysqlnd') && (defined('WP_CONTENT_DIR') && !file_exists(WP_CONTENT_DIR . '/db.php') || !file_exists(ABSPATH . 'wp-content/db.php'))) {
        require_once ABSPATH . WPINC . '/functions.php';
        wp_load_translations_early();
        $args = array('exit' => false, 'code' => 'mysql_not_found');
        wp_die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'), __('Requirements Not Met'), $args);
        exit(1);
    }
}

WordPress Version: 5.6

/**
 * Check for the required PHP version, and the MySQL extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = phpversion();
    if (version_compare($required_php_version, $php_version, '>')) {
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        printf('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.', $php_version, $wp_version, $required_php_version);
        exit(1);
    }
    if (!extension_loaded('mysql') && !extension_loaded('mysqli') && !extension_loaded('mysqlnd') && (defined('WP_CONTENT_DIR') && !file_exists(WP_CONTENT_DIR . '/db.php') || !file_exists(ABSPATH . 'wp-content/db.php'))) {
        require_once ABSPATH . WPINC . '/functions.php';
        wp_load_translations_early();
        $args = array('exit' => false, 'code' => 'mysql_not_found');
        wp_die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'), __('Requirements Not Met'), $args);
        exit(1);
    }
}

WordPress Version: 5.3

/**
 * Check for the required PHP version, and the MySQL extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = phpversion();
    if (version_compare($required_php_version, $php_version, '>')) {
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        printf('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.', $php_version, $wp_version, $required_php_version);
        exit(1);
    }
    if (!extension_loaded('mysql') && !extension_loaded('mysqli') && !extension_loaded('mysqlnd') && !file_exists(WP_CONTENT_DIR . '/db.php')) {
        require_once ABSPATH . WPINC . '/functions.php';
        wp_load_translations_early();
        $args = array('exit' => false, 'code' => 'mysql_not_found');
        wp_die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'), __('Requirements Not Met'), $args);
        exit(1);
    }
}

WordPress Version: 2.1

/**
 * Check for the required PHP version, and the MySQL extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = phpversion();
    if (version_compare($required_php_version, $php_version, '>')) {
        wp_load_translations_early();
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        /* translators: 1: Current PHP version number, 2: WordPress version number, 3: Minimum required PHP version number */
        printf(__('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.'), $php_version, $wp_version, $required_php_version);
        exit(1);
    }
    if (!extension_loaded('mysql') && !extension_loaded('mysqli') && !extension_loaded('mysqlnd') && !file_exists(WP_CONTENT_DIR . '/db.php')) {
        require_once ABSPATH . WPINC . '/functions.php';
        wp_load_translations_early();
        $args = array('exit' => false, 'code' => 'mysql_not_found');
        wp_die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'), __('Insufficient Requirements'), $args);
        exit(1);
    }
}

WordPress Version: 4.7

/**
 * Check for the required PHP version, and the MySQL extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = phpversion();
    if (version_compare($required_php_version, $php_version, '>')) {
        wp_load_translations_early();
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        /* translators: 1: Current PHP version number, 2: WordPress version number, 3: Minimum required PHP version number */
        die(sprintf(__('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.'), $php_version, $wp_version, $required_php_version));
    }
    if (!extension_loaded('mysql') && !extension_loaded('mysqli') && !extension_loaded('mysqlnd') && !file_exists(WP_CONTENT_DIR . '/db.php')) {
        wp_load_translations_early();
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'));
    }
}

WordPress Version: 4.5

/**
 * Check for the required PHP version, and the MySQL extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = phpversion();
    if (version_compare($required_php_version, $php_version, '>')) {
        wp_load_translations_early();
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        die(sprintf(__('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.'), $php_version, $wp_version, $required_php_version));
    }
    if (!extension_loaded('mysql') && !extension_loaded('mysqli') && !extension_loaded('mysqlnd') && !file_exists(WP_CONTENT_DIR . '/db.php')) {
        wp_load_translations_early();
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'));
    }
}

WordPress Version: 4.4

/**
 * Check for the required PHP version, and the MySQL extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = phpversion();
    if (version_compare($required_php_version, $php_version, '>')) {
        wp_load_translations_early();
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        die(sprintf(__('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.'), $php_version, $wp_version, $required_php_version));
    }
    if (!extension_loaded('mysql') && !extension_loaded('mysqli') && !file_exists(WP_CONTENT_DIR . '/db.php')) {
        wp_load_translations_early();
        $protocol = wp_get_server_protocol();
        header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
        header('Content-Type: text/html; charset=utf-8');
        die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'));
    }
}

WordPress Version: 4.0

/**
 * Check for the required PHP version, and the MySQL extension or
 * a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @since 3.0.0
 * @access private
 *
 * @global string $required_php_version The required PHP version string.
 * @global string $wp_version           The WordPress version string.
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = phpversion();
    if (version_compare($required_php_version, $php_version, '>')) {
        wp_load_translations_early();
        header('Content-Type: text/html; charset=utf-8');
        die(sprintf(__('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.'), $php_version, $wp_version, $required_php_version));
    }
    if (!extension_loaded('mysql') && !extension_loaded('mysqli') && !file_exists(WP_CONTENT_DIR . '/db.php')) {
        wp_load_translations_early();
        header('Content-Type: text/html; charset=utf-8');
        die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'));
    }
}

WordPress Version: 3.9

/**
 * Check for the required PHP version, and the MySQL extension or a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @access private
 * @since 3.0.0
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = phpversion();
    if (version_compare($required_php_version, $php_version, '>')) {
        wp_load_translations_early();
        header('Content-Type: text/html; charset=utf-8');
        die(sprintf(__('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.'), $php_version, $wp_version, $required_php_version));
    }
    if (!extension_loaded('mysql') && !extension_loaded('mysqli') && !file_exists(WP_CONTENT_DIR . '/db.php')) {
        wp_load_translations_early();
        header('Content-Type: text/html; charset=utf-8');
        die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'));
    }
}

WordPress Version: 3.7

/**
 * Check for the required PHP version, and the MySQL extension or a database drop-in.
 *
 * Dies if requirements are not met.
 *
 * @access private
 * @since 3.0.0
 */
function wp_check_php_mysql_versions()
{
    global $required_php_version, $wp_version;
    $php_version = phpversion();
    if (version_compare($required_php_version, $php_version, '>')) {
        wp_load_translations_early();
        die(sprintf(__('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.'), $php_version, $wp_version, $required_php_version));
    }
    if (!extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php')) {
        wp_load_translations_early();
        die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'));
    }
}