MediaWiki  REL1_22
PHPVersionError.php
Go to the documentation of this file.
00001 <?php
00040 function wfPHPVersionError( $type ) {
00041     $mwVersion = '1.22';
00042     $minimumVersionPHP = '5.3.2';
00043 
00044     $phpVersion = phpversion();
00045     $protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
00046     $message = "MediaWiki $mwVersion requires at least PHP version $minimumVersionPHP, you are using PHP $phpVersion.";
00047     if ( $type == 'cli' ) {
00048         $finalOutput = "You are using PHP version $phpVersion but MediaWiki $mwVersion needs PHP $minimumVersionPHP or higher. ABORTING.\n" .
00049         "Check if you have a newer php executable with a different name, such as php5.\n";
00050     } elseif ( $type == 'index.php' ) {
00051         $pathinfo = pathinfo( $_SERVER['SCRIPT_NAME'] );
00052         $encLogo = htmlspecialchars(
00053             str_replace( '//', '/', $pathinfo['dirname'] . '/' ) .
00054             'skins/common/images/mediawiki.png'
00055         );
00056 
00057         header( "$protocol 500 MediaWiki configuration Error" );
00058         header( 'Content-type: text/html; charset=UTF-8' );
00059         // Don't cache error pages!  They cause no end of trouble...
00060         header( 'Cache-control: none' );
00061         header( 'Pragma: no-cache' );
00062 
00063         $finalOutput = <<<HTML
00064 <!DOCTYPE html>
00065 <html lang="en" dir="ltr">
00066     <head>
00067         <meta charset="UTF-8" />
00068         <title>MediaWiki {$mwVersion}</title>
00069         <style media='screen'>
00070             body {
00071                 color: #000;
00072                 background-color: #fff;
00073                 font-family: sans-serif;
00074                 padding: 2em;
00075                 text-align: center;
00076             }
00077             p, img, h1 {
00078                 text-align: left;
00079                 margin: 0.5em 0;
00080             }
00081             h1 {
00082                 font-size: 120%;
00083             }
00084         </style>
00085     </head>
00086     <body>
00087         <img src="{$encLogo}" alt='The MediaWiki logo' />
00088         <h1>MediaWiki {$mwVersion} internal error</h1>
00089         <div class='error'>
00090         <p>
00091             {$message}
00092         </p>
00093         <p>
00094             Please consider <a href="http://www.php.net/downloads.php">upgrading your copy of PHP</a>.
00095             PHP versions less than 5.3.0 are no longer supported by the PHP Group and will not receive
00096             security or bugfix updates.
00097         </p>
00098         <p>
00099             If for some reason you are unable to upgrade your PHP version, you will need to
00100             <a href="http://www.mediawiki.org/wiki/Download">download</a> an older version
00101             of MediaWiki from our website.  See our
00102             <a href="http://www.mediawiki.org/wiki/Compatibility#PHP">compatibility page</a>
00103             for details of which versions are compatible with prior versions of PHP.
00104         </p>
00105         </div>
00106     </body>
00107 </html>
00108 HTML;
00109     // Handle everything that's not index.php
00110     } else {
00111         // So nothing thinks this is JS or CSS
00112         $finalOutput = ( $type == 'load.php' ) ? "/* $message */" : $message;
00113         header( "$protocol 500 MediaWiki configuration Error" );
00114     }
00115     echo "$finalOutput\n";
00116     die( 1 );
00117 }