wp_check_php_mysql_versions

Check for the required PHP version, and the MySQL extension or a database drop-in.

Description

wp_check_php_mysql_versions(); 

Dies if requirements are not met.


Usage

  1. if ( !function_exists( 'wp_check_php_mysql_versions' ) ) { 
  2. require_once ABSPATH . WPINC . '/load.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_check_php_mysql_versions(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/load.php  
  1. function wp_check_php_mysql_versions() { 
  2. global $required_php_version, $wp_version; 
  3. $php_version = phpversion(); 
  4.  
  5. if ( version_compare( $required_php_version, $php_version, '>' ) ) { 
  6.  
  7. $protocol = wp_get_server_protocol(); 
  8. header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 ); 
  9. header( 'Content-Type: text/html; charset=utf-8' ); 
  10. /** translators: 1: Current PHP version number, 2: WordPress version number, 3: Minimum required PHP version number */ 
  11. 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 ) ); 
  12.  
  13. if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) { 
  14.  
  15. $protocol = wp_get_server_protocol(); 
  16. header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 ); 
  17. header( 'Content-Type: text/html; charset=utf-8' ); 
  18. die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );