Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
/admin/ -> phpinfo.php (source)
   1  <?php
   2         // phpinfo.php - shows phpinfo for the current server
   3  
   4      require_once("../config.php");
   5      require_once($CFG->libdir.'/adminlib.php');
   6  
   7      admin_externalpage_setup('phpinfo');
   8  
   9      echo $OUTPUT->header();
  10  
  11      echo '<div class="phpinfo text-ltr">';
  12  
  13      ob_start();
  14      phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES + INFO_VARIABLES);
  15      $html = ob_get_contents();
  16      ob_end_clean();
  17  
  18  /// Delete styles from output
  19      $html = preg_replace('#(\n?<style[^>]*?>.*?</style[^>]*?>)|(\n?<style[^>]*?/>)#is', '', $html);
  20      $html = preg_replace('#(\n?<head[^>]*?>.*?</head[^>]*?>)|(\n?<head[^>]*?/>)#is', '', $html);
  21  /// Delete DOCTYPE from output
  22      $html = preg_replace('/<!DOCTYPE html PUBLIC.*?>/is', '', $html);
  23  /// Delete body and html tags
  24      $html = preg_replace('/<html.*?>.*?<body.*?>/is', '', $html);
  25      $html = preg_replace('/<\/body><\/html>/is', '', $html);
  26  
  27      echo $html;
  28  
  29      echo '</div>';
  30  
  31      echo $OUTPUT->footer();
  32  
  33