<?php
define ( 'PHP_INFO_SHOW_USERNAMES' , false );
if ( ! empty( $_SERVER['AUTH_USER'] ) ) {
$_SERVER['AUTH_USER'] = '*********';
}
if ( ! empty( $_SERVER['AUTH_PASSWORD'] ) ) {
$_SERVER['AUTH_PASSWORD'] = '*********';
}
header( 'Cache-Control: no-cache, no store' );
header( 'Link: </phpinfo.css>; rel=preload; as=style', false );
#header( 'Link: </favicon.ico>; rel=icon', false );
}
?><!DOCTYPE HTML>
<html lang="de">
<head>
<meta charset="utf-8">
<link rel="Shortcut Icon" href="/favicon.ico" />
<link rel="Stylesheet" href="/phpinfo.css" />
<meta name="robots" content="noindex,noarchive,nosnippet,noodp,notranslate,noimageindex">
<title><?=$_SERVER['SERVER_NAME']; ?>: PHP-Informationen</title>
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<body>
<h1>🛠 <?=$_SERVER['SERVER_NAME']; ?>: PHP-Informationen<br><span class='subline'><a href="https://code.fastix.org/Projekte/PHP:Replacement%20f%c3%bcr%20phpinfo()/">Tool von Jörg Reinholz</a>, <a href='https://www.fastix.org/'>fastix WebDesign & Consult, Kassel</a>.</span></h1>
<?php if ( isset( $_GET['show_ini_only'] ) && 'true' == $_GET['show_ini_only'] ) { ?>
<h4 id="INI"><a class="toplink" href="?">⮉</a>Ini-Einstellungen: Gelesene Dateien</h4>
<table>
<?php
if ( strlen( $filelist ) > 0) {
?><tr><td> </td><td></td> </tr><?php
$i=0;
foreach ($files as $f) {
Printline ( 'danach (' . ++$i . '.)' , $f );
}
}
}
?></table><?php
?>
<h4>Glesene Ini-Einstellungen:</h4>
<table class="showhover">
<tbody>
<?php
iniShow();
?>
</tbody>
</table><?php
echo '<h4><a class="toplink" href="#">⮉ </a>(nach oben)</h4>';
echo "</body>\n</html>\n";
} elseif ( isset( $_GET['show_constants_only'] ) && 'true' == $_GET['show_constants_only'] ) {
echo '<h4><a class="toplink" href="?">⮉</a>Konstanten:</h4>'."\n";
echo '<h4><a class="toplink" href="#">⮉ </a>(nach oben)</h4>';
echo "</body>\n</html>\n";
} elseif ( isset( $_GET['show_linuxlocales_only'] ) && 'true' == $_GET['show_linuxlocales_only'] ) {
echo '<h4><a class="toplink" href="?">⮉</a>Alle installierten Linux-Locales:</h4>'."\n";
if ( is_file( '/usr/bin/locale' ) ) {
PrintHash ( ( new linuxLocales) -> getLocales(), true );
} else {
echo "<p>Fehler: Dies scheint kein Linux zu sein.</p>";
}
echo '<h4><a class="toplink" href="#">⮉ </a>(nach oben)</h4>';
echo "</body>\n</html>\n";
} elseif ( isset( $_GET['show_apache_only'] ) && 'true' == $_GET['show_apache_only'] ) {
echo '<h4><a class="toplink" href="?">⮉</a>Apache-Version:</h4>'."\n";
echo findApache();
echo '<h4><a class="toplink" href="?">⮉</a>Apache-Module:</h4>'."\n";
echo '<p>' . str_replace( "\n",', ', trim (`ls
/etc
/apache2
/mods
-enabled
| grep
-v
'.conf' | sed
-e
"s/\.load//"`
) ) . '</p>';
} elseif ( isset( $_GET['show_nginx_only'] ) && 'true' == $_GET['show_nginx_only'] ) {
echo '<h4><a class="toplink" href="?">⮉</a>NGINX-Version:</h4>'."\n";
echo findNginx();
echo '<h4><a class="toplink" href="?">⮉</a>NGINX-Module:</h4>'."\n";
echo '<ul><li>' . str_replace( "\n",'<li>', trim (`ls
"/etc/nginx/modules-enabled/" | sed
-e
"s/\.conf//" | sed
-e
"s/^[0-9-]*//"`
) ) . '</ul>';
} elseif ( isset( $_GET['show_system_only'] ) && 'true' == $_GET['show_system_only'] ) {
echo '<h4><a class="toplink" href="?">⮉</a>Posix: System-Informationen:</h4>'."\n";
echo '<h4><a class="toplink" href="?">⮉</a>Posix: System-Limits:</h4>'."\n";
echo '<h4><a class="toplink" href="#">⮉ </a>(nach oben)</h4>';
echo "</body>\n</html>\n";
}
?>
<nav><a href="#_SERVER">$_SERVER</a>
| <a href="#_ENV">$_ENV</a>
<?php } ?>
| <a href="#_GET">$_GET</a>
| <a href="#_POST">$_POST</a>
| <a href="#_COOKIE">$_COOKIE</a>
| <a href="#_SESSION">$_SESSION</a>
| <a href="#_REQUEST">$_REQUEST</a>
| <a href="#_FILES">$_FILES</a>
| <a href="#GLOBALS">$GLOBALS</a>
</nav><nav>(Nur:) <a href="<?=$_SERVER['PHP_SELF'];?>?show_ini_only=true">Ini-Settings</a>
| <a href="<?=$_SERVER['PHP_SELF'];?>?show_constants_only=true">Konstanten</a>
<?php if ( is_file( '/usr/bin/locale' ) ) { ?>
| <a href="?show_linuxlocales_only=true">Linux-locales</a>
<?php
}
if ( findApache() ) {
?>
| <a href="?show_apache_only=true">Apache-Informationen</a>
<?php } else if ( findNginx() ) { ?>
| <a href="?show_nginx_only=true">NGINX-Informationen</a>
<?php } ?>
| <a href="?show_system_only=true">System-Informationen</a>
</nav>
<h4><a class="toplink" href="#">⮉</a>PHP-Version, SAPI und Module:</h4>
<?php
$pattern='/[0-9]+\.[0-9]+/';
if ( PHP_INFO_SHOW_USERNAMES ) {
?>
<?php } else { ?>
<?php
}
unset( $pattern, $matches ); ?>
<?php showVars (); ?>
<h4><a class="toplink" href="#">⮉ </a>(nach oben)</h4>
</body>
</html><?php
function return_bytes( $val ) {
switch( $last ) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024*1024*1024;
case 'm':
$val *= 1024*1024;
case 'k':
$val *= 1024;
}
return $val;
}
function Printline ( $key, $val ) {
echo "\n" . " <tr>\n <td>" . htmlentities($key) . "</td>\n <td>";
PrintHash ( $val, true );
} else {
}
echo "</td>\n\t</tr>";
}
function PrintHash ( $ar, $showhover=false ) {
$DontShow = [ '_ENV', '_GET', '_POST', '_COOKIE', '_SESSION', '_REQUEST', '_FILES', '_SERVER', 'GLOBALS' ];
if ( $showhover ) {
$class=" class='showhover'";
} else {
$class="";
}
echo '<table' . $class . ">\n<thead>\n<tr><th>Schlüssel</th><th>Wert</th></tr>\n</thead>\n<tbody>";
foreach ( $ar as $key => $val ) {
Printline ( $key, $val );
}
}
echo "\n</tbody>\n</table>\n";
} else {
echo "(leer)";
}
}
class linuxLocales {
private $all;
function __construct () {
if (! is_file( '/usr/bin/locale' ) ) {
return false;
}
$rows = explode( "\n", `
/usr
/bin
/locale
-a`
);
foreach ( $rows as $row ) {
if ( $row = trim( $row ) ) {
$this -> all[] = $row;
}
}
}
function getLocales( $grep='' ) {
if ( $grep ) {
$pattern = '/^' . $grep . '.*$/';
return $ar;
} else {
return $this -> all;
}
}
}
function iniShow () {
if ( in_array( $key, getForbiddenIniSettings
() ) ){
echo '
<tr>
<td>***********</td>';
} elseif ( '' !== $arIni[$key]['global_value'] && '' !== $arIni[$key]['local_value'] ) {
echo '
<tr>
if ( $arIni[$key]['global_value'] == $arIni[$key]['local_value'] ) {
echo '
} else {
echo '
<td><strong>Lokal gültig: ' . htmlentities( str_replace( ',', ', ', $arIni[$key]['local_value'] ) ) . '( wird benutzt)</strong><br>
}
}
}
}
function showVars () {
$ar = [ '_GET', '_POST', '_COOKIE', '_SESSION', '_REQUEST', '_FILES', '_SERVER', 'GLOBALS' ];
$ar[$new] = $ar[ $new - 1 ];
$ar[ $new - 1 ] = '_ENV';
}
foreach ( $ar as $varname ) {
echo '<h4 id="' . $varname . '"><a class="toplink" href="#">⮉</a>Globale Variable «$' . $varname . '»:</h4>'."\n";
if ( '_GET' == $varname ) {
echo '<h5>HTTP_QUERY_STRING:</h5>';
if ( isset( $_SERVER['QUERY_STRING'] ) && $data = $_SERVER['QUERY_STRING'] ) {
} else {
echo '<div>(leer)</div>';
}
echo '<h5>Generiertes $_GET:</h5>';
}
if ( '_POST' == $varname ) {
echo '<h5>php://input :</h5>';
} else {
echo '<div>(leer)</div>';
}
echo '<h5>Generiertes $_POST:</h5>';
}
if ( 'GLOBALS' == $varname ) {
echo '<p><strong>Hinweis:</strong> Die enthaltenen Superglobalen «$';
echo '» werden hier nicht erneut angezeigt.</p>';
}
@eval( 'PrintHash( $' . $varname . ', ( $varname !== "GLOBALS" ) );');
#$val=$$varname; PrintHash( ( $val), ( $val !== "GLOBALS" ) );
#PrintHash( $$varname, ( $varname !== "GLOBALS" ) );
}
}
function findApache() {
$apache = false;
foreach ( [
'/usr/sbin/apache2',
'/usr/sbin/apache',
'/usr/sbin/httpd',
'/usr/sbin/httpd2'
] as $t ) {
$apache = $t;
break;
}
}
if ( $apache && is_file('/etc/apache2/envvars' ) ) {
$apache = ". /etc/apache2/envvars; $apache";
return '<p>' . str_replace( "\n", "<br>", `
$apache -v`
) . '</p>';
} else {
return false;
}
}
function findNginx() {
$nginx = false;
if ( ! is_file( '/usr/sbin/nginx' ) ) {
return false;
}
return '<p>' . $_SERVER['SERVER_SOFTWARE']. '</p>';
}
function getForbiddenIniSettings() {
'mysql.default_user',
'mysql.default_password',
'mysqli.default_pw',
'mysqli.default_user',
'odbc.default_pw',
'odbc.default_user'
);
}