3 * Display something vaguely comprehensible in the event of a totally unrecoverable error.
4 * Does not assume access to *anything*; no globals, no autloader, no database, no localisation.
5 * Safe for PHP4 (and putting this here means that WebStart.php and GlobalSettings.php
6 * no longer need to be).
8 * Calling this function kills execution immediately.
10 * @param $type String Which entry point we are protecting. One of:
16 * @note Since we can't rely on anything, the minimum PHP versions and MW current
17 * version are hardcoded here
19 function wfPHPVersionError( $type ){
21 $phpVersion = PHP_VERSION
;
22 $message = "MediaWiki $mwVersion requires at least PHP version 5.2.3, you are using PHP $phpVersion.";
23 if( $type == 'index.php' ) {
24 $encLogo = htmlspecialchars(
25 str_replace( '//', '/', pathinfo( $_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME
) . '/'
26 ) . 'skins/common/images/mediawiki.png'
29 header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500 );
30 header( 'Content-type: text/html; charset=UTF-8' );
31 // Don't cache error pages! They cause no end of trouble...
32 header( 'Cache-control: none' );
33 header( 'Pragma: nocache' );
35 $finalOutput = <<<HTML
36 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
37 <html xmlns='http://www.w3.org/1999/xhtml' lang='en'>
39 <title>MediaWiki {$mwVersion}</title>
40 <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
41 <style type='text/css' media='screen'>
44 background-color: #fff;
45 font-family: sans-serif;
59 <img src="{$encLogo}" alt='The MediaWiki logo' />
60 <h1>MediaWiki {$mwVersion} internal error</h1>
66 Please consider <a href="http://www.php.net/downloads.php">upgrading your copy of PHP</a>.
67 PHP versions less than 5.3.0 are no longer supported by the PHP Group and will not receive
68 security or bugfix updates.
71 If for some reason you are unable to upgrade your PHP version, you will need to
72 <a href="http://www.mediawiki.org/wiki/Download">download</a> an older version
73 of MediaWiki from our website. See our
74 <a href="http://www.mediawiki.org/wiki/Compatibility#PHP">compatibility page</a>
75 for details of which versions are compatible with prior versions of PHP.
81 // Handle everything that's not index.php
83 // So nothing thinks this is JS or CSS
84 $finalOutput = ( $type == 'load.php' ) ?
"/* $message */" : $message;
85 if( $type != 'cli' ) {
86 header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500 );
89 echo( "$finalOutput\n" );