コード例 #1
0
function collectConfigurationFiles()
{
    $files = array(php_ini_loaded_file());
    $scannedFiles = php_ini_scanned_files();
    if ($scannedFiles) {
        foreach (explode(',', $scannedFiles) as $file) {
            array_push($files, trim($file));
        }
    }
    return $files;
}
コード例 #2
0
ファイル: IniHelper.php プロジェクト: Rudloff/composer
 /**
  * Returns an array of php.ini locations with at least one entry
  *
  * The equivalent of calling php_ini_loaded_file then php_ini_scanned_files.
  * The loaded ini location is the first entry and may be empty.
  * @return array
  */
 public static function getAll()
 {
     if ($env = strval(getenv(self::ENV_ORIGINAL))) {
         return explode(PATH_SEPARATOR, $env);
     }
     $paths = array(strval(php_ini_loaded_file()));
     if ($scanned = php_ini_scanned_files()) {
         $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
     }
     return $paths;
 }
コード例 #3
0
ファイル: ListIniCommand.php プロジェクト: WebDevJL/phpbrew
 public function execute()
 {
     if ($filelist = php_ini_scanned_files()) {
         echo "Loaded ini files:\n";
         if (strlen($filelist) > 0) {
             $files = explode(',', $filelist);
             foreach ($files as $file) {
                 echo " - " . trim($file) . "\n";
             }
         }
     }
 }
コード例 #4
0
 private function createExtensionHint()
 {
     $paths = array();
     if (($iniPath = php_ini_loaded_file()) !== false) {
         $paths[] = $iniPath;
     }
     if (!defined('HHVM_VERSION') && ($additionalIniPaths = php_ini_scanned_files())) {
         $paths = array_merge($paths, array_map("trim", explode(",", $additionalIniPaths)));
     }
     if (count($paths) === 0) {
         return '';
     }
     $text = "\n  To enable extensions, verify that they are enabled in those .ini files:\n    - ";
     $text .= implode("\n    - ", $paths);
     $text .= "\n  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
     return $text;
 }
コード例 #5
0
 public static function phpInfos()
 {
     $php = array();
     $php['version'] = phpversion();
     $iniVars = ini_get_all();
     $loadedExtensions = get_loaded_extensions();
     // $ext = new ReflectionExtension('mysqli');
     // $ext->info();
     $memoryPeak = memory_get_peak_usage();
     $memoryUsage = memory_get_usage();
     $iniLoaded = php_ini_loaded_file();
     $iniScanned = php_ini_scanned_files();
     $symfony = new Symfony();
     $symfony->initRequirements();
     $symfony->initOptionalRequirements();
     $majesteel = new MajesTeel();
     $majesteel->initRequirements();
     $majesteel->initOptionalRequirements();
     Flight::render('templates/phpInfos.tpl', array('php' => $php, 'iniVars' => $iniVars, 'loadedExtensions' => $loadedExtensions, 'memoryPeak' => $memoryPeak, 'memoryUsage' => $memoryUsage, 'iniLoaded' => $iniLoaded, 'iniScanned' => $iniScanned, 'symfony' => $symfony, 'majesteel' => $majesteel));
 }
コード例 #6
0
ファイル: info.php プロジェクト: petrparolek/web_cms
<?php

/**
 * @internal
 */
$iniFiles = array_merge(($tmp = php_ini_loaded_file()) === FALSE ? array() : array($tmp), strlen($tmp = php_ini_scanned_files()) ? explode(",\n", trim($tmp)) : array());
$extensions = get_loaded_extensions();
natcasesort($extensions);
$values = array('PHP binary' => defined('PHP_BINARY') ? PHP_BINARY : '(not available)', 'PHP version' => PHP_VERSION . ' (' . PHP_SAPI . ')', 'Loaded php.ini files' => count($iniFiles) ? implode(', ', $iniFiles) : '(none)', $last = 'Loaded extensions' => count($extensions) ? implode(', ', $extensions) : '(none)');
foreach ($values as $title => $value) {
    echo "{$title}\n";
    echo "" . str_repeat('-', strlen($title)) . "\n";
    echo $value . "\n";
    echo $title === $last ? '' : "\n\n";
}
コード例 #7
0
ファイル: info.php プロジェクト: nette/tester
<?php

/**
 * @internal
 */
$isPhpDbg = defined('PHPDBG_VERSION');
$isHhvm = defined('HHVM_VERSION');
$extensions = get_loaded_extensions();
natcasesort($extensions);
$info = (object) ['binary' => defined('PHP_BINARY') ? PHP_BINARY : NULL, 'version' => PHP_VERSION, 'phpDbgVersion' => $isPhpDbg ? PHPDBG_VERSION : NULL, 'sapi' => PHP_SAPI, 'hhvmVersion' => $isHhvm ? HHVM_VERSION : NULL, 'iniFiles' => array_merge(($tmp = php_ini_loaded_file()) === FALSE ? [] : [$tmp], function_exists('php_ini_scanned_files') && strlen($tmp = php_ini_scanned_files()) ? explode(",\n", trim($tmp)) : []), 'extensions' => $extensions, 'canMeasureCodeCoverage' => $isPhpDbg || !$isHhvm && in_array('xdebug', $extensions, TRUE)];
if (isset($_SERVER['argv'][1])) {
    echo serialize($info);
    die;
}
foreach (['PHP binary' => $info->binary ?: '(not available)', 'PHP version' . ($isPhpDbg ? '; PHPDBG version' : '') . ($isHhvm ? '; HHVM version' : '') => "{$info->version} ({$info->sapi})" . ($isPhpDbg ? "; {$info->phpDbgVersion}" : '') . ($isHhvm ? "; {$info->hhvmVersion}" : ''), 'Loaded php.ini files' => count($info->iniFiles) ? implode(', ', $info->iniFiles) : ($isHhvm ? '(unable to detect under HHVM)' : '(none)'), 'Loaded extensions' => count($info->extensions) ? implode(', ', $info->extensions) : '(none)'] as $title => $value) {
    echo "{$title}:\n{$value}\n\n";
}
echo "\n";
コード例 #8
0
ファイル: yf_debug.class.php プロジェクト: yfix/yf
 /**
  */
 function _debug_DEBUG_YF(&$params = [])
 {
     if (!$this->SHOW_SETTINGS) {
         return '';
     }
     $cache_use = (main()->USE_SYSTEM_CACHE || conf('USE_CACHE')) && !cache()->NO_CACHE;
     $locale_debug = $this->_get_debug_data('locale');
     $data['yf'] = ['MAIN_TYPE' => MAIN_TYPE, 'LANG' => conf('language'), 'IP' => common()->get_ip(), 'COUNTRY' => conf('country') ?: $_SERVER['GEOIP_COUNTRY_CODE'], 'TIMEZONE' => date_default_timezone_get() . (conf('timezone') ? ', conf: ' . conf('timezone') : ''), 'DEBUG_MODE' => (int) DEBUG_MODE, 'DEV_MODE' => (int) conf('DEV_MODE'), 'REWRITE_MODE' => (int) tpl()->REWRITE_MODE, 'DEBUG_CONSOLE_POPUP' => (int) conf('DEBUG_CONSOLE_POPUP'), 'CACHE_USE' => (int) $cache_use, 'CACHE_NO_CACHE' => (int) cache()->NO_CACHE, 'CACHE_NO_WHY' => cache()->_NO_CACHE_WHY, 'CACHE_DRIVER' => cache()->DRIVER, 'CACHE_NS' => cache()->CACHE_NS, 'CACHE_TTL' => (int) cache()->TTL, 'YF_PATH' => YF_PATH, 'YF_VERSION' => $this->_get_yf_version(), 'APP_PATH' => APP_PATH, 'APP_VERSION' => $this->_get_app_version(), 'PROJECT_PATH' => PROJECT_PATH, 'SITE_PATH' => SITE_PATH, 'ADMIN_SITE_PATH' => ADMIN_SITE_PATH, 'CONFIG_PATH' => CONFIG_PATH, 'STORAGE_PATH' => STORAGE_PATH, 'LOGS_PATH' => LOGS_PATH, 'UPLOADS_PATH' => UPLOADS_PATH, 'WEB_PATH' => WEB_PATH, 'MEDIA_PATH' => MEDIA_PATH, 'ADMIN_WEB_PATH' => ADMIN_WEB_PATH, 'CSS_FRAMEWORK' => conf('css_framework') ?: 'bs2', 'BOOTSTRAP_THEME' => common()->bs_current_theme() ?: $_COOKIE['yf_theme'] ?: (conf('DEF_BOOTSTRAP_THEME_' . strtoupper(MAIN_TYPE)) ?: conf('DEF_BOOTSTRAP_THEME')), 'TPL_DRIVER' => tpl()->DRIVER_NAME, 'TPL_COMPILE' => (int) tpl()->COMPILE_TEMPLATES, 'TPL_THEMES_PATH' => tpl()->_THEMES_PATH, 'TPL_PATH' => tpl()->TPL_PATH, 'TPL_SKIN' => conf('theme'), 'TPL_INHERIT_SKIN' => (string) tpl()->INHERIT_SKIN, 'TPL_INHERIT_SKIN2' => (string) tpl()->INHERIT_SKIN2, 'MAIN_HOSTNAME' => main()->HOSTNAME, 'SITE_ID' => (int) conf('SITE_ID'), 'SERVER_ID' => (int) conf('SERVER_ID'), 'SERVER_ROLE' => _prepare_html(conf('SERVER_ROLE')), 'SERVER_ADDR' => $_SERVER['SERVER_ADDR'], 'SERVER_SELF_IPS' => implode(', ', (array) main()->_server_self_ips), 'USER_ID' => (int) main()->USER_ID, 'USER_GROUP' => (int) main()->USER_GROUP, 'USER_ROLE' => main()->USER_ROLE, 'IS_POST' => (int) main()->is_post(), 'IS_AJAX' => (int) main()->is_ajax(), 'IS_HTTPS' => (int) main()->is_https(), 'IS_CONSOLE' => (int) main()->is_console(), 'IS_REDIRECT' => (int) main()->is_redirect(), 'IS_COMMON_PAGE' => (int) main()->is_common_page(), 'IS_UNIT_TEST' => (int) main()->is_unit_test(), 'IS_SPIDER' => (int) conf('IS_SPIDER'), 'NO_GRAPHICS' => (int) main()->NO_GRAPHICS, 'HTTP_HOST' => $_SERVER['HTTP_HOST'], 'SERVER_PORT' => $_SERVER['SERVER_PORT'], 'REWRITE_DEF_HOST' => _class('rewrite')->DEFAULT_HOST, 'REWRITE_DEF_PORT' => _class('rewrite')->DEFAULT_PORT, 'WEB_DOMAIN' => WEB_DOMAIN, 'REQUEST_URI' => $_SERVER['REQUEST_URI'], 'REQUEST_METHOD' => $_SERVER['REQUEST_METHOD'], 'OUTPUT_CACHING' => (int) main()->OUTPUT_CACHING, 'NO_CACHE_HEADERS' => (int) main()->NO_CACHE_HEADERS, 'HTTP_IN_HEADERS' => $this->_get_request_headers(), 'HTTP_OUT_HEADERS' => headers_list(), 'LOCALE_CURRENT' => $locale_debug['current'], 'LOCALE_VARIANTS' => $locale_debug['variants'], 'LOCALE_DEFAULT' => $locale_debug['default'], 'LOCALE_SYSTEM' => implode(', ', (array) $locale_debug['system'])];
     foreach ((array) $this->_get_debug_data('_DEBUG_META') as $k => $v) {
         $data['yf']['META_' . strtoupper($k)] = $v;
     }
     $ini_all = ini_get_all();
     $ini = ['memory_limit', 'max_execution_time', 'default_socket_timeout', 'max_input_time', 'memory_limit', 'post_max_size', 'upload_max_filesize', 'file_uploads', 'allow_url_fopen', 'error_reporting', 'display_errors'];
     foreach ($ini as $name) {
         $data['ini']['php_ini&nbsp;:&nbsp;' . $name] = $ini_all[$name]['local_value'];
     }
     if (tpl()->COMPRESS_OUTPUT && !main()->NO_GRAPHICS) {
         $c_info = $this->_get_debug_data('compress_output');
         $data['ini'] += ['compress: size original' => $c_info['size_original'] . ' bytes', 'compress: size compressed' => $c_info['size_compressed'] . ' bytes', 'compress: ratio' => ($c_info['size_compressed'] ? round($c_info['size_original'] / $c_info['size_compressed'] * 100, 0) : 0) . '%'];
     }
     $loaded_exts = [];
     foreach (get_loaded_extensions() as $v) {
         $loaded_exts[] = strtolower($v);
     }
     asort($loaded_exts);
     $data['ini'] += ['memory_usage' => function_exists('memory_get_usage') ? memory_get_usage() : 'n/a', 'memory_peak_usage' => function_exists('memory_get_peak_usage') ? memory_get_peak_usage() : 'n/a', 'sys_loadavg' => implode(' | ', sys_getloadavg()), 'db_server_version' => db()->get_server_version(), 'db_host_info' => db()->get_host_info(), 'php_version' => phpversion(), 'php_sapi_name' => php_sapi_name(), 'php_current_user' => get_current_user(), 'php_uname' => php_uname(), 'php_include_path' => get_include_path(), 'php_loaded_extensions' => implode(', ', $loaded_exts), 'php_ini_scanned_files' => function_exists('php_ini_scanned_files') ? php_ini_scanned_files() : ''];
     $data['session']['session_id'] = session_id();
     foreach ((array) ini_get_all('session') as $k => $v) {
         $data['session'][$k] = $v['local_value'];
     }
     $a = $_POST + $_SESSION;
     $body .= form($a, ['action' => url('/test/change_debug'), 'class' => 'form-inline', 'style' => 'padding-left:20px;'])->row_start()->container('Locale edit')->active_box('locale_edit', ['selected' => $_SESSION['locale_vars_edit']])->container('<span style="padding-left:20px;">Debug console light</span>')->active_box('debug_console_light', ['selected' => $_SESSION['debug_console_light']])->row_end()->save(['class' => 'btn btn-default btn-mini btn-xs']);
     foreach ($data as $name => $_data) {
         foreach ($_data as $k => $v) {
             if ($name == 'yf' && ($k == 'YF_VERSION' || $k == 'APP_VERSION')) {
                 continue;
             }
             $_data[$k] = _prepare_html($v);
         }
         $body .= '<div class="span6 col-md-6">' . $this->_show_key_val_table($_data, ['no_total' => 1, 'no_sort' => 1, 'no_escape' => 1]) . '</div>';
     }
     return $body;
 }
コード例 #9
0
/**
* generate nonce value
* @return string
*/
function ssl_insecure_content_fix_nonce_value()
{
    // some system data, difficult to guess unless server environment is already known
    $data = sprintf("%s\n%s\n%s\n%s", php_uname(), php_ini_loaded_file(), php_ini_scanned_files(), implode("\n", get_loaded_extensions()));
    return md5($data);
}
コード例 #10
0
ファイル: info.php プロジェクト: cujan/vcelyweb
<?php

/**
 * @internal
 */
$iniFiles = array_merge(($tmp = php_ini_loaded_file()) === FALSE ? array() : array($tmp), function_exists('php_ini_scanned_files') && strlen($tmp = php_ini_scanned_files()) ? explode(",\n", trim($tmp)) : array());
$extensions = get_loaded_extensions();
natcasesort($extensions);
$isHhvm = defined('HHVM_VERSION');
$values = array('PHP binary' => defined('PHP_BINARY') ? PHP_BINARY : '(not available)', 'PHP version' . ($isHhvm ? '; HHVM version' : '') => PHP_VERSION . ' (' . PHP_SAPI . ')' . ($isHhvm ? '; ' . HHVM_VERSION : ''), 'Loaded php.ini files' => count($iniFiles) ? implode(', ', $iniFiles) : ($isHhvm ? '(unable to detect under HHVM)' : '(none)'), $last = 'Loaded extensions' => count($extensions) ? implode(', ', $extensions) : '(none)');
foreach ($values as $title => $value) {
    echo "{$title}\n";
    echo "" . str_repeat('-', strlen($title)) . "\n";
    echo $value . "\n";
    echo $title === $last ? '' : "\n\n";
}
コード例 #11
0
ファイル: Installer.php プロジェクト: m6w6/pharext
 private function activate($temp)
 {
     if ($this->args->ini) {
         $files = [$this->args->ini];
     } else {
         $files = array_filter(array_map("trim", explode(",", php_ini_scanned_files())));
         $files[] = php_ini_loaded_file();
     }
     $sudo = isset($this->args->sudo) ? $this->args->sudo : null;
     $type = $this->metadata("type") ?: "extension";
     $activate = new Task\Activate($temp, $files, $type, $this->args->prefix, $this->args["common-name"], $sudo);
     if (!$activate->run($this->verbosity())) {
         $this->info("Extension already activated ...\n");
     }
 }
コード例 #12
0
ファイル: handy.php プロジェクト: Rambutan/hamsterpaj
    echo '<li style="float: left;list-style-type: none; margin: 5px"><a href="?page=' . $handle . '" style="color: black;' . ($page == $handle ? 'font-weight: bold' : '') . '">' . $user_friendly . '</a></li>' . "\n";
}
echo '</ul>' . "\n\n";
echo '<br style="clear: both" />' . "\n\n";
echo '<h2>' . $page_descriptions[$page] . '</h2>' . "\n";
switch ($page) {
    case 'session':
        preint_r($_SESSION);
        break;
    case 'server_vars':
        echo '<h3>$_SERVER</h3>' . "\n";
        preint_r($_SERVER);
        echo '<h3>$_ENV</h3>' . "\n";
        preint_r($_ENV);
        echo '<h3>Loaded ini files:</h3>' . "\n";
        if ($ini_files = php_ini_scanned_files()) {
            if (strlen($ini_files) > 0) {
                preint_r(explode(',', str_replace('\\n', '', $ini_files)));
            } else {
                echo 'Could not find any ini-files...';
            }
        }
        break;
    case 'phpinfo':
        phpinfo();
        break;
    case 'remote_session':
        if (isset($_GET['username']) && mb_strtolower($_GET['username']) != 'borttagen') {
            $query = 'SELECT session_id FROM login WHERE username = "******"';
            $result = mysql_query($query) or report_sql_error($query);
            if (mysql_num_rows($result) == 1) {
コード例 #13
0
ファイル: check.php プロジェクト: rangulicon/mkvmanager
        $phpExtensionsFailure[] = $extensionName;
    }
}
// -- Directory persmissions
$writableDirectories = array('tmp');
$writableDirectoriesFailure = array();
foreach ($writableDirectories as $directoryName) {
    if (!is_writable(ROOT . DIRECTORY_SEPARATOR . $directoryName)) {
        $writableDirectoriesFailure[] = $directoryName;
    }
}
// @todo check permissions in TV shows and movies folder (needed to downloads subtitles and nfo)
// DISPLAY ERRORS
if (!empty($phpExtensionsFailure)) {
    echo "Missing PHP extensions : " . implode(", ", $phpExtensionsFailure) . "<br />";
    echo "First check if you have enabled these extensions in your php.ini file or any other included files : \n<pre>\n" . implode("\n", explode(", ", php_ini_scanned_files())) . "\n</pre>";
    echo "If needed, you can try to do this :\n<pre>\naptitude install sqlite\n</pre>\nThis should install both sqlite and pdo_sqlite";
    echo "<hr />";
}
if (!empty($writableDirectoriesFailure)) {
    $apacheUser = exec('whoami');
    echo "These directories are not writable by your browser : " . implode(", ", $writableDirectoriesFailure) . "<br />";
    echo "Document root is : " . ROOT . "<br />";
    echo "Apache user : {$apacheUser}<br />";
    echo "You can try to do this :\n<pre>\ncd " . ROOT . "\nchgrp -R {$apacheUser} " . implode(" ", $writableDirectoriesFailure) . "\nchmod -R g+rw " . implode(" ", $writableDirectoriesFailure) . "\n</pre>";
    echo "<hr />";
}
if (!empty($phpExtensionsFailure) or !empty($writableDirectoriesFailure)) {
    echo "<br />";
    echo "Please fix this and retry";
    exit(1);
コード例 #14
0
                        <i class="fa fa-<?php 
echo function_exists('mcrypt_encrypt') ? 'check fa-icon-color-green' : 'times fa-icon-color-red';
?>
"></i>&nbsp;mcrypt<br />
                        <i class="fa fa-<?php 
echo function_exists('xdebug_get_code_coverage') ? 'check fa-icon-color-green' : 'times fa-icon-color-red';
?>
"></i>&nbsp;XDebug<br />
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-4">PHP .ini Files</div>
                    <div class="col-md-8">
                        <?php 
echo php_ini_loaded_file() . '<br />';
echo php_ini_scanned_files() . '<br />';
?>
                    </div>
                </div>
            </div>
        </div>
        <div id="footer" class="footer">
            <div class="container">
                <p class="muted pull-right"><strong><a href="https://github.com/TimothyDJones/laravel-precise32-php5.4">Laravel Vagrant LAMP Box</a></strong></p>
            </div>

        </div>
        <div class="modal fade" id="phpinfoModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
コード例 #15
0
ファイル: XdebugHandler.php プロジェクト: detain/composer
 /**
  * Returns true if additional inis were loaded
  *
  * @param array $iniFiles Populated by method
  * @param bool $replace Whether we need to modify the files
  *
  * @return bool
  */
 private function getAdditionalInis(array &$iniFiles, &$replace)
 {
     $replace = true;
     if ($scanned = php_ini_scanned_files()) {
         $list = explode(',', $scanned);
         foreach ($list as $file) {
             $file = trim($file);
             if (preg_match('/xdebug.ini$/', $file)) {
                 // Skip the file, no need for regex replacing
                 $replace = false;
             } else {
                 $iniFiles[] = $file;
             }
         }
     }
     return !empty($scanned);
 }
コード例 #16
0
<?php

var_dump(php_ini_scanned_files());
コード例 #17
0
ファイル: Scan.php プロジェクト: giuseppemorelli/iniscan
 /**
  * Parse the configuration (php.ini) file
  *
  * @param string $path Path to the string to parse
  * @return array Ini settings
  */
 public function parseConfig($path = null)
 {
     $ini = parse_ini_file(!is_null($path) ? $path : $this->path);
     // pull in settings from other scanned INI files
     $scannedIniList = php_ini_scanned_files();
     if ($scannedIniList !== false) {
         foreach (explode(',', $scannedIniList) as $scannedFile) {
             $scannedIni = parse_ini_file(trim($scannedFile));
             $ini = array_merge($ini, $scannedIni);
         }
     }
     $this->setConfig($ini);
     return $ini;
 }
コード例 #18
0
ファイル: run-test-info.php プロジェクト: hltj/tfs
<?php

echo "\nPHP_SAPI    : ", PHP_SAPI, "\nPHP_VERSION : ", phpversion(), "\nZEND_VERSION: ", zend_version(), "\nPHP_OS      : ", PHP_OS, " - ", php_uname(), "\nINI actual  : ", realpath(get_cfg_var("cfg_file_path")), "\nMore .INIs  : ", function_exists('php_ini_scanned_files') ? str_replace("\n", "", php_ini_scanned_files()) : "** not determined **";
コード例 #19
0
ファイル: check.php プロジェクト: precurse/netharbour
// <tr><td class="e">System </td><td class="v">Windows NT BLINKYZERO 6.0 build 6000 </td></tr>
// since preg_* are potentially missing, we'll have to do this without regexps.
foreach (explode("\n", $s) as $line) {
    $line = str_replace('<tr><td class="e">', '', $line);
    $line = str_replace('</td></tr>', '', $line);
    $line = str_replace(' </td><td class="v">', ' => ', $line);
    $sep_pos = strpos($line, " => ");
    if ($sep_pos !== FALSE) {
        // by here, it should be a straight "name => value"
        $name = substr($line, 0, $sep_pos);
        $value = substr($line, $sep_pos + 4);
        $php_general[$name] = $value;
    }
}
$ini_file = $php_general['Loaded Configuration File'];
$extra_ini = php_ini_scanned_files();
if ($extra_ini != '') {
    $extra_ini = "The following additional ini files were read: {$extra_ini}";
} else {
    $extra_ini = "There were no additional ini files, according to PHP.";
}
$gdversion = "";
$gdbuiltin = FALSE;
$gdstring = "";
if (function_exists('gd_info')) {
    $gdinfo = gd_info();
    $gdversion = $gdinfo['GD Version'];
    if (strpos($gdversion, "bundled") !== FALSE) {
        $gdbuiltin = TRUE;
        $gdstring = "This PHP uses the 'bundled' GD library, which doesn't have alpha-blending bugs. That's good!\n";
    } else {
コード例 #20
0
ファイル: php-test.php プロジェクト: yangsensen/Dockerfile
<?php

switch ($_GET['test']) {
    case 'sha1':
        echo sha1('webdevops');
        break;
    case 'version':
        echo 'PHP ' . phpversion();
        break;
    case 'php_sapi_name':
        echo php_sapi_name();
        break;
    case 'get_loaded_extensions':
        $moduleList = array_merge(get_loaded_extensions(), get_loaded_extensions(true));
        echo implode("\n", $moduleList);
        break;
    case 'php_ini_scanned_files':
        echo php_ini_scanned_files();
        break;
    default:
        header('HTTP/1.1 500 Internal Server Error');
        echo 'ERROR: Unknown test';
        break;
}
コード例 #21
0
 /**
  * Check the version of PHP, the needed PHP extension and a number
  * of configuration parameters (memory_limit, max_upload_file_size, etc...)
  * @param SetupPage $oP The page used only for its 'log' method
  * @return array An array of CheckResults objects
  */
 static function CheckPHPVersion()
 {
     $aResult = array();
     // For log file(s)
     if (!is_dir(APPROOT . 'log')) {
         @mkdir(APPROOT . 'log');
     }
     SetupPage::log('Info - CheckPHPVersion');
     if (version_compare(phpversion(), self::PHP_MIN_VERSION, '>=')) {
         $aResult[] = new CheckResult(CheckResult::INFO, "The current PHP Version (" . phpversion() . ") is greater than the minimum version required to run " . ITOP_APPLICATION . ", which is (" . self::PHP_MIN_VERSION . ")");
     } else {
         $aResult[] = new CheckResult(CheckResult::ERROR, "Error: The current PHP Version (" . phpversion() . ") is lower than the minimum version required to run " . ITOP_APPLICATION . ", which is (" . self::PHP_MIN_VERSION . ")");
     }
     // Check the common directories
     $aWritableDirsErrors = self::CheckWritableDirs(array('log', 'env-production', 'conf', 'data'));
     $aResult = array_merge($aResult, $aWritableDirsErrors);
     $aMandatoryExtensions = array('mysqli', 'iconv', 'simplexml', 'soap', 'hash', 'json', 'session', 'pcre', 'dom');
     $aOptionalExtensions = array('mcrypt' => 'Strong encryption will not be used.', 'ldap' => 'LDAP authentication will be disabled.');
     asort($aMandatoryExtensions);
     // Sort the list to look clean !
     ksort($aOptionalExtensions);
     // Sort the list to look clean !
     $aExtensionsOk = array();
     $aMissingExtensions = array();
     $aMissingExtensionsLinks = array();
     // First check the mandatory extensions
     foreach ($aMandatoryExtensions as $sExtension) {
         if (extension_loaded($sExtension)) {
             $aExtensionsOk[] = $sExtension;
         } else {
             $aMissingExtensions[] = $sExtension;
             $aMissingExtensionsLinks[] = "<a href=\"http://www.php.net/manual/en/book.{$sExtension}.php\" target=\"_blank\">{$sExtension}</a>";
         }
     }
     if (count($aExtensionsOk) > 0) {
         $aResult[] = new CheckResult(CheckResult::INFO, "Required PHP extension(s): " . implode(', ', $aExtensionsOk) . ".");
     }
     if (count($aMissingExtensions) > 0) {
         $aResult[] = new CheckResult(CheckResult::ERROR, "Missing PHP extension(s): " . implode(', ', $aMissingExtensionsLinks) . ".");
     }
     // Next check the optional extensions
     $aExtensionsOk = array();
     $aMissingExtensions = array();
     foreach ($aOptionalExtensions as $sExtension => $sMessage) {
         if (extension_loaded($sExtension)) {
             $aExtensionsOk[] = $sExtension;
         } else {
             $aMissingExtensions[$sExtension] = $sMessage;
         }
     }
     if (count($aExtensionsOk) > 0) {
         $aResult[] = new CheckResult(CheckResult::INFO, "Optional PHP extension(s): " . implode(', ', $aExtensionsOk) . ".");
     }
     if (count($aMissingExtensions) > 0) {
         foreach ($aMissingExtensions as $sExtension => $sMessage) {
             $aResult[] = new CheckResult(CheckResult::WARNING, "Missing optional PHP extension: {$sExtension}. " . $sMessage);
         }
     }
     // Check some ini settings here
     if (function_exists('php_ini_loaded_file')) {
         $sPhpIniFile = php_ini_loaded_file();
         // Other included/scanned files
         if ($sFileList = php_ini_scanned_files()) {
             if (strlen($sFileList) > 0) {
                 $aFiles = explode(',', $sFileList);
                 foreach ($aFiles as $sFile) {
                     $sPhpIniFile .= ', ' . trim($sFile);
                 }
             }
         }
         SetupPage::log("Info - php.ini file(s): '{$sPhpIniFile}'");
     } else {
         $sPhpIniFile = 'php.ini';
     }
     if (!ini_get('file_uploads')) {
         $aResult[] = new CheckResult(CheckResult::ERROR, "Files upload is not allowed on this server (file_uploads = " . ini_get('file_uploads') . ").");
     }
     $sUploadTmpDir = self::GetUploadTmpDir();
     if (empty($sUploadTmpDir)) {
         $sUploadTmpDir = '/tmp';
         $aResult[] = new CheckResult(CheckResult::WARNING, "Temporary directory for files upload is not defined (upload_tmp_dir), assuming that {$sUploadTmpDir} is used.");
     }
     // check that the upload directory is indeed writable from PHP
     if (!empty($sUploadTmpDir)) {
         if (!file_exists($sUploadTmpDir)) {
             $aResult[] = new CheckResult(CheckResult::ERROR, "Temporary directory for files upload ({$sUploadTmpDir}) does not exist or cannot be read by PHP.");
         } else {
             if (!is_writable($sUploadTmpDir)) {
                 $aResult[] = new CheckResult(CheckResult::ERROR, "Temporary directory for files upload ({$sUploadTmpDir}) is not writable.");
             } else {
                 SetupPage::log("Info - Temporary directory for files upload ({$sUploadTmpDir}) is writable.");
             }
         }
     }
     if (!ini_get('upload_max_filesize')) {
         $aResult[] = new CheckResult(CheckResult::ERROR, "File upload is not allowed on this server (upload_max_filesize = " . ini_get('upload_max_filesize') . ").");
     }
     $iMaxFileUploads = ini_get('max_file_uploads');
     if (!empty($iMaxFileUploads) && $iMaxFileUploads < 1) {
         $aResult[] = new CheckResult(CheckResult::ERROR, "File upload is not allowed on this server (max_file_uploads = " . ini_get('max_file_uploads') . ").");
     }
     $iMaxUploadSize = utils::ConvertToBytes(ini_get('upload_max_filesize'));
     $iMaxPostSize = utils::ConvertToBytes(ini_get('post_max_size'));
     if ($iMaxPostSize <= $iMaxUploadSize) {
         $aResult[] = new CheckResult(CheckResult::WARNING, "post_max_size (" . ini_get('post_max_size') . ") in php.ini should be strictly greater than upload_max_filesize (" . ini_get('upload_max_filesize') . ") otherwise you cannot upload files of the maximum size.");
     }
     SetupPage::log("Info - upload_max_filesize: " . ini_get('upload_max_filesize'));
     SetupPage::log("Info - post_max_size: " . ini_get('post_max_size'));
     SetupPage::log("Info - max_file_uploads: " . ini_get('max_file_uploads'));
     // Check some more ini settings here, needed for file upload
     if (function_exists('get_magic_quotes_gpc')) {
         if (@get_magic_quotes_gpc()) {
             $aResult[] = new CheckResult(CheckResult::ERROR, "'magic_quotes_gpc' is set to On. Please turn it Off in php.ini before continuing.");
         }
     }
     if (function_exists('magic_quotes_runtime')) {
         if (@magic_quotes_runtime()) {
             $aResult[] = new CheckResult(CheckResult::ERROR, "'magic_quotes_runtime' is set to On. Please turn it Off in php.ini before continuing.");
         }
     }
     $sMemoryLimit = trim(ini_get('memory_limit'));
     if (empty($sMemoryLimit)) {
         // On some PHP installations, memory_limit does not exist as a PHP setting!
         // (encountered on a 5.2.0 under Windows)
         // In that case, ini_set will not work, let's keep track of this and proceed anyway
         $aResult[] = new CheckResult(CheckResult::WARNING, "No memory limit has been defined in this instance of PHP");
     } else {
         // Check that the limit will allow us to load the data
         //
         $iMemoryLimit = utils::ConvertToBytes($sMemoryLimit);
         if ($iMemoryLimit < self::MIN_MEMORY_LIMIT) {
             $aResult[] = new CheckResult(CheckResult::ERROR, "memory_limit ({$iMemoryLimit}) is too small, the minimum value to run the application is " . self::MIN_MEMORY_LIMIT . ".");
         } else {
             SetupPage::log("Info - memory_limit is {$iMemoryLimit}, ok.");
         }
     }
     // Special case for APC
     if (extension_loaded('apc')) {
         $sAPCVersion = phpversion('apc');
         $aResult[] = new CheckResult(CheckResult::INFO, "APC detected (version {$sAPCVersion}). The APC cache will be used to speed-up " . ITOP_APPLICATION . ".");
     }
     // Special case Suhosin extension
     if (extension_loaded('suhosin')) {
         $sSuhosinVersion = phpversion('suhosin');
         $aOk[] = "Suhosin extension detected (version {$sSuhosinVersion}).";
         $iGetMaxValueLength = ini_get('suhosin.get.max_value_length');
         if ($iGetMaxValueLength < self::SUHOSIN_GET_MAX_VALUE_LENGTH) {
             $aResult[] = new CheckResult(CheckResult::WARNING, "suhosin.get.max_value_length ({$iGetMaxValueLength}) is too small, the minimum value recommended to run the application is " . self::SUHOSIN_GET_MAX_VALUE_LENGTH . ".");
         } else {
             SetupPage::log("Info - suhosin.get.max_value_length = {$iGetMaxValueLength}, ok.");
         }
     }
     if (function_exists('php_ini_loaded_file')) {
         $sPhpIniFile = php_ini_loaded_file();
         // Other included/scanned files
         if ($sFileList = php_ini_scanned_files()) {
             if (strlen($sFileList) > 0) {
                 $aFiles = explode(',', $sFileList);
                 foreach ($aFiles as $sFile) {
                     $sPhpIniFile .= ', ' . trim($sFile);
                 }
             }
         }
         $aResult[] = new CheckResult(CheckResult::INFO, "Loaded php.ini files: {$sPhpIniFile}");
     }
     // Check the configuration of the sessions persistence, since this is critical for the authentication
     if (ini_get('session.save_handler') == 'files') {
         $sSavePath = ini_get('session.save_path');
         SetupPage::log("Info - session.save_path is: '{$sSavePath}'.");
         // According to the PHP documentation, the format can be /path/where/to_save_sessions or "N;/path/where/to_save_sessions" or "N;MODE;/path/where/to_save_sessions"
         $sSavePath = ltrim(rtrim($sSavePath, '"'), '"');
         // remove surrounding quotes (if any)
         if (!empty($sSavePath)) {
             if (($iPos = strrpos($sSavePath, ';', 0)) !== false) {
                 // The actual path is after the last semicolon
                 $sSavePath = substr($sSavePath, $iPos + 1);
             }
             if (!is_writable($sSavePath)) {
                 $aResult[] = new CheckResult(CheckResult::ERROR, "The value for session.save_path ({$sSavePath}) is not writable for the web server. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)");
             } else {
                 $aResult[] = new CheckResult(CheckResult::INFO, "The value for session.save_path ({$sSavePath}) is writable for the web server.");
             }
         } else {
             $aResult[] = new CheckResult(CheckResult::WARNING, "Empty path for session.save_path. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)");
         }
     } else {
         $aResult[] = new CheckResult(CheckResult::INFO, "session.save_handler is: '" . ini_get('session.save_handler') . "' (different from 'files').");
     }
     return $aResult;
 }
コード例 #22
0
ファイル: CheckCommand.php プロジェクト: graste/environaut
 /**
  * Displays introductory text and some PHP configuration
  * and information (if --verbose was used as CLI option)
  */
 protected function displayIntro()
 {
     $input = $this->getInput();
     $output = $this->getOutput();
     $output->writeln('<info>Environment Check</info>');
     $output->writeln('=================' . PHP_EOL);
     if ($input->getOption('verbose')) {
         $output->writeln('<info>PHP Version</info>: ' . PHP_VERSION . ' on ' . PHP_OS . ' (installed to ' . PHP_BINDIR . ')');
         if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
             $output->writeln('<info>PHP Binary</info>: ' . PHP_BINARY);
         }
         $output->writeln('<info>User owning this script</info>: ' . get_current_user() . ' (uid=' . getmyuid() . ')');
         $output->writeln('<info>User running this script</info>: uid=' . posix_getuid() . ' (effective uid=' . posix_geteuid() . ') gid=' . posix_getgid() . ' (effective gid=' . posix_getegid() . ')' . PHP_EOL);
         $output->writeln('<info>Loaded php.ini File</info>: ' . php_ini_loaded_file());
         $output->writeln('<info>Additionally Scanned Files</info>: ' . php_ini_scanned_files());
         $output->writeln('<info>PHP Include Path</info>: ' . ini_get('include_path') . PHP_EOL);
     }
     $output->writeln('<info>Reading configuration from</info>: ' . $this->config_path . PHP_EOL);
 }
コード例 #23
0
ファイル: index.php プロジェクト: N9dZ/www
sort($loaded_extensions, SORT_LOCALE_STRING);
foreach ($loaded_extensions as $extension) {
    $phpExtContents .= "<li>{$extension}</li>";
}
//vérifications diverses - Quel php.ini est chargé ?
$phpini = strtolower(trim(str_replace("\\", "/", php_ini_loaded_file())));
$c_phpConfFileOri = strtolower($c_phpVersionDir . '/php' . $wampConf['phpVersion'] . '/' . $phpConfFileForApache);
$c_phpCliConf = strtolower($c_phpVersionDir . '/php' . $wampConf['phpVersion'] . '/' . $wampConf['phpConfFile']);
if ($phpini != strtolower($c_phpConfFile) && $phpini != $c_phpConfFileOri) {
    $error_content .= "<p style='color:red;'>*** ERROR *** The PHP configuration loaded file is: " . $phpini . " - should be: " . $c_phpConfFile . " or " . $c_phpConfFileOri;
    if ($phpini == $c_phpCliConf || $phpini == $c_phpCliConfFile) {
        $error_content .= " - This file is only for PHP in Command Line - Maybe you've added 'PHPIniDir' in the 'httpd.conf' file. Delete or comment this line.";
    }
    $error_content .= "</p>";
}
if ($filelist = php_ini_scanned_files()) {
    if (strlen($filelist) > 0) {
        $error_content .= "<p style='color:red;'>*** ERROR *** There are too much php.ini files</p>";
        $files = explode(',', $filelist);
        foreach ($files as $file) {
            $error_content .= "<p style='color:red;'>*** ERROR *** There are other php.ini files: " . trim(str_replace("\\", "/", $file)) . "</p>";
        }
    }
}
$pageContents = <<<EOPAGE
<!DOCTYPE html>
<html>
<head>
\t<title>{$langues[$langue]['titreHtml']}</title>
\t<meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
コード例 #24
0
ファイル: FirePHP.php プロジェクト: jerfowler/firephp-libs
 public function recordEnvironment($console = false)
 {
     if (!$console) {
         $console = FirePHP::to('page')->console('Environment');
     }
     if (!$console->is(true)) {
         return false;
     }
     $console = $console->nolimit();
     $console->label('PHP Version')->log(phpversion());
     $console->label('PHP Extensions')->log(get_loaded_extensions());
     $console->table('$_GET', isset($_GET) ? $_GET : false);
     $console->table('$_POST', isset($_POST) ? $_POST : false);
     $console->table('$_REQUEST', isset($_REQUEST) ? $_REQUEST : false);
     $console->table('$_COOKIE', isset($_COOKIE) ? $_COOKIE : false);
     $console->table('$_FILES', isset($_FILES) ? $_FILES : false);
     $console->table('$_SERVER', isset($_SERVER) ? $_SERVER : false);
     $console->table('$_ENV', isset($_ENV) ? $_ENV : false);
     $console->table('$HTTP_GET_VARS', isset($HTTP_GET_VARS) ? $HTTP_GET_VARS : false);
     $console->table('$HTTP_POST_VARS', isset($HTTP_POST_VARS) ? $HTTP_POST_VARS : false);
     $console->table('$HTTP_COOKIE_VARS', isset($HTTP_COOKIE_VARS) ? $HTTP_COOKIE_VARS : false);
     $console->table('$HTTP_SERVER_VARS', isset($HTTP_SERVER_VARS) ? $HTTP_SERVER_VARS : false);
     $console->table('$HTTP_ENV_VARS', isset($HTTP_ENV_VARS) ? $HTTP_ENV_VARS : false);
     $group = $console->nolimit(false)->group();
     $group->log('$GLOBALS');
     foreach ($GLOBALS as $key => $value) {
         switch ($key) {
             case 'GLOBALS':
             case '_ENV':
             case 'HTTP_ENV_VARS':
             case '_POST':
             case 'HTTP_POST_VARS':
             case '_GET':
             case 'HTTP_GET_VARS':
             case '_COOKIE':
             case 'HTTP_COOKIE_VARS':
             case '_SERVER':
             case 'HTTP_SERVER_VARS':
             case '_FILES':
             case 'HTTP_POST_FILES':
             case '_REQUEST':
                 // skip
                 break;
             default:
                 $group->label($key)->log($value);
                 break;
         }
     }
     $table = array();
     foreach (ini_get_all() as $name => $info) {
         $row = array($name, $info['global_value'], $info['local_value'], array());
         if ($info['access'] & INI_ALL) {
             $row[3][] = 'All';
         } else {
             if ($info['access'] & INI_USER) {
                 $row[3][] = 'User';
             }
             if ($info['access'] & INI_PERDIR) {
                 $row[3][] = 'Perdir';
             }
             if ($info['access'] & INI_SYSTEM) {
                 $row[3][] = 'System';
             }
         }
         $row[3] = implode(', ', $row[3]);
         $table[] = $row;
     }
     $console->table('Configuration Options', $table, array('Name', 'Global', 'Local', 'Access'));
     $console->label('Error Reporting')->log(FirePHP_Plugin_Engine::parseErrorReportingBitmask(error_reporting()));
     $console->label('get_include_path()')->log(get_include_path());
     if (function_exists('sys_get_temp_dir')) {
         $console->label('sys_get_temp_dir()')->log(sys_get_temp_dir());
     }
     if (function_exists('php_ini_loaded_file')) {
         $console->label('php_ini_loaded_file()')->log(php_ini_loaded_file());
     }
     $console->label('php_ini_scanned_files()')->log(php_ini_scanned_files());
     $console->label('php_sapi_name()')->log(php_sapi_name());
     $console->label('php_uname()')->log(php_uname());
     // TODO: Register a function to be called on shutdown to record included files
     return true;
 }