[ Index ]

PHP Cross Reference of GASELL SVN Trunk

title

Body

[close]

/gasell/ -> bugreport.php (source)

   1  <?php
   2  /*
   3   * Gasell: Copyright 2007 Linux-Nantes Association <contact@linux-nantes.org>
   4   *
   5   * You should have received a copy of the GNU Public
   6   * License along with this package; if not, write to the
   7   * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
   8   * Boston, MA 02110, USA.
   9   *
  10   * Authors: GrdScarabe <grdscarabe@grdscarabe.net>
  11   *
  12   * Histoire
  13   *  * 23/01/07 GrdScarabe : Implementation initiale
  14   */
  15  
  16  /**
  17   * Ce fichier permet de generer un certain nombre d'informations a propos
  18   * de la configuration du serveur courant afin d'accompagner les rapports
  19   * de bug du necessaire pour qu'ils soient traites correctement.
  20   */
  21  
  22  /**
  23   * Fonction pour ecrire le texte simplement sans avoir a se
  24   * preoccuper des retours a la ligne.
  25   */
  26  function println($str) { echo $str."\n"; }
  27  function check($str) {
  28      $val = ini_get($str);
  29      if( is_bool($val) )
  30          return $val ? "oui" : "non";
  31      elseif ( $val == NULL )
  32          return "null";
  33      else
  34          return $val;
  35  }
  36  function checkc($str) {
  37      if ( defined($str) )
  38          return eval("return $str;");
  39      else
  40          return "not defined";
  41  }
  42  
  43  // on genere du texte car c'est plus simple pour les rapports de bug
  44  // ils peuvent ainsi directement etre recupere par un wget ou bien 
  45  // par un navigateur en mode console.
  46  header("Content-type: text/plain");
  47  
  48  // message informatif sur le contenu
  49  println( "+------------------------------------------------------------+" );
  50  println( "|    Le rapport ci-dessous fournit des informations sur la   |" );
  51  println( "| configuration du serveur. Pour des raisons de securite, il |" );
  52  println( "| ne peut etre genere qu'a partir du serveur lui-meme.       |" );
  53  println( "|    En theorie, ce rapport ne contient pas d'informations   |" );
  54  println( "| personnelles vous concernant. Cependant, si vous en touvez |" );
  55  println( "| n'hesiter pas a les cacher du rapport final.               |" );
  56  println( "|    Les rapports de bug peuvent etre soumis par le biais de |" );
  57  println( "| l'interface a l'adresse :                                  |" );
  58  println( "|       https://gna.org/bugs/?func=additem&group=gasell      |" );
  59  println( "+------------------------------------------------------------+" );
  60  
  61  // tableau contenant des conseils sur la configuration de PHP
  62  $tips = array();
  63  
  64  // on s'assure que le script est appele de 127.0.0.1
  65  if ( $_SERVER['REMOTE_ADDR'] != "127.0.0.1" and 
  66       $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'] ) {
  67      
  68      // on refuse l'acces au script pour des raisons de securite
  69      println( "Desole, l'acces a ce script n'est possible que depuis le" );
  70      println( "serveur l'hebergeant. Le script est donc suspendu !" );
  71      println( "                 ---------------" );
  72      println( "Sorry, this script cannot be executed other than from" );
  73      println( "the server hosting it. The execution is stopped !");
  74  
  75  } else {
  76  
  77      /** CONFIGURATION GLOBALE  **/
  78      println( "----------- CONFIGURATION GLOBALE -----------" );
  79      println( "Systeme d'exploitation : " . php_uname('a') );
  80      println( "OS de compilation PHP  : " . PHP_OS );
  81      println( "Serveur Web            : " . $_SERVER['SERVER_SOFTWARE'] );
  82      println( "Version de PHP         : " . phpversion() );
  83      if ( version_compare(phpversion(), "5.0.0", ">=" ) == 1 )
  84          if ( ini_get('zend.ze1_compatibility_mode') == 1 )
  85              println ( "Mode compatibilite Zend 1 active" );
  86          else {
  87              println ( "Mode compatibilite Zend 1 desactive" );
  88              $tips[] = "Il est conseille d'activer le mode de "
  89                  . "compatibilite avec Zend 1 (zend.ze1_compatibility_mode)";
  90          }
  91      println( "Version de Zend        : " . zend_version() );
  92      println( "Interface PHP/Serveur  : " . php_sapi_name() );
  93      println( "Utilisateur PID        : " . get_current_user() );
  94  
  95      /** CONFIGURATION DE PHP **/
  96      println( "----------- CONFIGURATION DE PHP -----------" );
  97      println( "Memoire maximum disponible : " . check('memory_limit')  );
  98      println( "Temps execution maximum    : " . check('max_execution_time') );
  99      println( "Track des variables (\$_GET, ...) : " . check('track_vars') );
 100      println( "Register globals : " . check('register_globals') );
 101      println( "Register argc,argv (install) : " . check('register_argc_argv') );
 102      println( "Support des tableaux HTTP_*_VARS : " . check('register_long_arrays') );
 103      println( "Autorisation d'uploader : " . check('file_uploads') );
 104      println( "Repertoire temporaire d'upload : " . check('upload_tmp_dir') );
 105      println( "Taille maximale d'upload : " . check('upload_max_filesize') );
 106      println( "Taille maximum pour POST : " . check('post_max_size') );
 107      println( "Ordre de prise en compte de GET, POST et COOKIE : " . check('gpc_order') );
 108      if ( ini_get('auto_prepend_file') != "" )
 109          println( "Fichier inclus en debut de chaque script : " . check('auto_prepend_file') );
 110      println( "Charset par defaut : " . check('default_charset') );
 111      println( "Magic quotes : " . get_magic_quotes_runtime() );
 112      
 113      /** EXTENSIONS **/
 114      println( "----------- INCLUSIONS / EXTENSIONS -----------" );
 115      println( "Path pour les inclusions : " . check('include_path') );
 116      $db_support = false;
 117      $xml_support = false;
 118      foreach( get_loaded_extensions() as $ext ) {
 119          println( "L'extension " . $ext . " est chargee." );
 120          if ( $ext == "mysql" or $ext == "pgsql" )
 121              $db_support = true;
 122          if ( $ext == "libxml" or $ext == "domxml" )
 123              $xml_support = true;
 124      }
 125      
 126      /** CONSTANTES **/
 127      println( "----------- CONSTANTES -----------" );
 128      println( "Safe thread dans Zend : " . checkc('ZEND_THREAD_SAFE') );
 129      println( "Taille maximale pour un INT : " . checkc('PHP_INT_MAX') );
 130      println( "Taille maximale pour un CHAR : " . checkc('CHAR_MAX') );
 131      println( "Version de la lib XML : " . checkc('LIBXML_DOTTED_VERSION') );
 132      println( "XML_SAX_IMPL : " . checkc('XML_SAX_IMPL') );
 133  
 134      /** SQL **/
 135      println( "----------- SQL ET DATABASES -----------" );
 136      println( "Activation de sqlsafe : " . check('sql.safe_mode') );
 137  
 138      /** CONSEILS **/
 139      if ( ini_get('register_globals') )
 140          $tips = "L'activation de register_globals est dangereux";
 141      if ( ini_get('post_max_size') <= ini_get('upload_max_filesize') )
 142          $tips[] = "Il est inutile d'avoir un taille d'upload superieure a "
 143              . " la taille maximale de POST car le second limite le premier";
 144      if ( ini_get('register_long_arrays') )
 145          $tips[] = "Il serait preferable de desactiver le support des"
 146              ." tableaux longs et les remplacer par l'utilisation de 'track_vars'";
 147      if ( get_magic_quotes_runtime() == 1 )
 148          $tips[] = "Il est conseille de desactiver les magic quotes pour Gasell";
 149      if ( ! $db_support )
 150          $tips[] = "Votre configuration ne semble pas capable de communiquer"
 151              . " avec une base supportee par GASELL";
 152      if ( ! $xml_support )
 153          $tips[] = "Votre configuration n'integre pas le support du xml"
 154              . ", il est necessaire de l'activer pour GASELL";
 155      // on affiche les conseils 
 156      println( "+------------------------------------------------------------+" );
 157      println( "|   Voici quelques conseils a propos de votre configuration  |" );
 158      println( "+------------------------------------------------------------+" );
 159      foreach( $tips as $tip ) {
 160          println( $tip );
 161      }
 162  }
 163  
 164  ?>


Generated: Tue Jan 6 01:17:25 2009 Cross-referenced by PHPXref 0.7