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