+// So extensions (and other code) can check whether they're running in API mode
+define( 'MW_API', true );
+
+// We want a plain message on catastrophic errors that machines can identify
+function wfDie( $msg = '' ) {
+ header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500 );
+ echo $msg;
+ die( 1 );
+}
+
+// Die on unsupported PHP versions
+if( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.2.3' ) < 0 ){
+ $version = htmlspecialchars( $wgVersion );
+ wfDie( "MediaWiki $version requires at least PHP version 5.2.3." );
+}
+
+// Initialise common code.