dolibarr/htdocs/admin/system/phpinfo.php

243 lines
7.2 KiB
PHP
Raw Normal View History

<?php
2012-08-02 10:07:55 +02:00
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2012-09-21 00:13:20 +02:00
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
2018-10-27 14:43:12 +02:00
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
2016-07-15 17:58:14 +02:00
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
2002-04-30 12:51:35 +02:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
2002-04-30 12:51:35 +02:00
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2002-04-30 12:51:35 +02:00
*/
/**
2009-01-18 18:35:29 +01:00
* \file htdocs/admin/system/phpinfo.php
* \brief Page des infos systeme de php
2009-01-18 18:35:29 +01:00
*/
require '../../main.inc.php';
2013-06-05 16:24:32 +02:00
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load("admin");
2020-01-15 10:02:18 +01:00
$langs->load("install");
$langs->load("errors");
2012-08-02 10:07:55 +02:00
if (! $user->admin)
accessforbidden();
2009-01-18 18:35:29 +01:00
/*
* View
*/
llxHeader();
2012-09-21 00:13:20 +02:00
$title='InfoPHP';
2009-01-18 18:35:29 +01:00
2012-09-30 21:26:58 +02:00
if (isset($title))
{
print load_fiche_titre($langs->trans($title), '', 'title_setup');
2012-09-30 21:26:58 +02:00
}
2009-01-18 18:35:29 +01:00
// Check PHP setup is OK
$maxphp=@ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
$maxphp2=@ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
{
$langs->load("errors");
print info_admin($langs->trans("WarningParamUploadMaxFileSizeHigherThanPostMaxSize", @ini_get('upload_max_filesize'), @ini_get('post_max_size')), 0, 0, 0, 'warning');
print '<br>';
}
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">';
2013-06-05 16:24:32 +02:00
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print "\n";
2020-01-15 10:02:18 +01:00
$ErrorPicturePath = "../../theme/eldy/img/error.png";
$WarningPicturePath = "../../theme/eldy/img/warning.png";
$OkayPicturePath = "../../theme/eldy/img/tick.png";
2020-01-15 10:02:18 +01:00
print '<tr><td width="220">'.$langs->trans("Version").'</td><td>';
2020-01-15 10:13:55 +01:00
$arrayphpminversionerror = array(5,5,0);
$arrayphpminversionwarning = array(5,5,0);
2020-01-15 10:21:36 +01:00
if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0)
2020-01-15 10:02:18 +01:00
{
print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));
}
2020-01-15 10:13:55 +01:00
elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0)
2020-01-15 10:02:18 +01:00
{
2020-01-15 10:13:55 +01:00
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning));
2020-01-15 10:02:18 +01:00
}
else
{
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.versiontostring(versionphparray());
}
print '</td></tr>';
print '<tr><td>GET and POST support</td><td>';
2020-01-15 12:56:36 +01:00
if (! isset($_GET["testget"]) && ! isset($_POST["testpost"]) && ! isset($_GET["mainmenu"]))
2020-01-15 10:02:18 +01:00
{
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("PHPSupportPOSTGETKo");
print ' (<a href="'.$_SERVER["PHP_SELF"].'?testget=ok">'.$langs->trans("Recheck").'</a>)';
}
else
{
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportPOSTGETOk");
}
print '</td></tr>';
print '<tr><td>Sessions support</td><td>';
if (! function_exists("session_id"))
{
2020-01-15 10:13:55 +01:00
print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions");
2020-01-15 10:02:18 +01:00
}
else
{
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportSessions");
}
print '</td></tr>';
print '<tr><td>GD support</td><td>';
if (! function_exists("imagecreate"))
{
2020-01-15 10:13:55 +01:00
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportGD");
2020-01-15 10:02:18 +01:00
}
else
{
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportGD");
}
print '</td></tr>';
print '<tr><td>Curl support</td><td>';
if (! function_exists("curl_init"))
{
2020-01-15 10:13:55 +01:00
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportCurl");
2020-01-15 10:02:18 +01:00
}
else
{
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportCurl");
}
print '</td></tr>';
print '<tr><td>UTF-8 support</td><td>';
2020-01-15 10:02:18 +01:00
if (! function_exists("utf8_encode"))
{
2020-01-15 10:13:55 +01:00
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8");
2020-01-15 10:02:18 +01:00
}
else
{
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportUTF8");
}
print '</td></tr>';
print '<tr><td>Intl support</td><td>';
2020-01-15 10:02:18 +01:00
if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost')
{
if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region"))
{
2020-01-15 10:13:55 +01:00
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportIntl");
2020-01-15 10:02:18 +01:00
}
else
{
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportIntl");
}
}
2020-01-16 01:11:39 +01:00
print '<tr><td>Zip support</td><td>';
if (!class_exists('ZipArchive'))
{
2020-01-16 01:40:14 +01:00
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "Zip");
2020-01-16 01:11:39 +01:00
}
else
{
2020-01-16 01:40:14 +01:00
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "Zip");
2020-01-16 01:11:39 +01:00
}
2020-01-15 10:02:18 +01:00
print '</td></tr>';
print '</table>';
2020-01-15 12:56:36 +01:00
print '<br>';
2012-09-30 21:26:58 +02:00
// Get php_info array
2012-09-21 00:13:20 +02:00
$phparray=phpinfo_array();
foreach($phparray as $key => $value)
{
2017-01-17 20:04:41 +01:00
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
2012-09-30 21:26:58 +02:00
print '<tr class="liste_titre">';
2012-09-21 00:13:20 +02:00
//print '<td width="220px">'.$langs->trans("Parameter").'</td>';
2012-09-30 21:26:58 +02:00
print '<td width="220px">'.$key.'</td>';
print '<td colspan="2">'.$langs->trans("Value").'</td>';
print "</tr>\n";
2012-09-21 00:13:20 +02:00
//var_dump($value);
foreach($value as $keyparam => $keyvalue)
{
if (! is_array($keyvalue))
{
2017-04-13 15:59:51 +02:00
print '<tr class="oddeven">';
2012-09-30 21:26:58 +02:00
print '<td>'.$keyparam.'</td>';
2012-09-21 00:13:20 +02:00
$valtoshow=$keyvalue;
if ($keyparam == 'X-ChromePhp-Data') $valtoshow=dol_trunc($keyvalue, 80);
print '<td colspan="2">';
if ($keyparam == 'Path') $valtoshow=implode('; ', explode(';', trim($valtoshow)));
if ($keyparam == 'PATH') $valtoshow=implode('; ', explode(';', trim($valtoshow)));
if ($keyparam == '_SERVER["PATH"]') $valtoshow=implode('; ', explode(';', trim($valtoshow)));
print $valtoshow;
print '</td>';
2012-09-21 00:13:20 +02:00
print '</tr>';
}
else
{
2017-04-13 15:59:51 +02:00
print '<tr class="oddeven">';
2012-09-21 00:13:20 +02:00
print '<td>'.$keyparam.'</td>';
$i=0;
2012-09-30 21:26:58 +02:00
foreach($keyvalue as $keyparam2 => $keyvalue2)
2012-09-21 00:13:20 +02:00
{
print '<td>';
$valtoshow=$keyvalue2;
if ($keyparam == 'disable_functions') $valtoshow=implode(', ', explode(',', trim($valtoshow)));
//print $keyparam;
2012-09-30 21:26:58 +02:00
print $valtoshow;
2012-09-21 00:13:20 +02:00
$i++;
print '</td>';
}
print '</tr>';
}
}
2017-01-17 20:04:41 +01:00
print '</table>';
print '</div>';
print '<br>';
}
2012-09-30 21:26:58 +02:00
2018-07-28 14:29:28 +02:00
// End of page
2011-08-27 21:15:14 +02:00
llxFooter();
2012-08-02 10:07:55 +02:00
$db->close();