本文整理汇总了PHP中ini_get_all函数的典型用法代码示例。如果您正苦于以下问题:PHP ini_get_all函数的具体用法?PHP ini_get_all怎么用?PHP ini_get_all使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ini_get_all函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: server_info
function server_info()
{
$lang =& DoceboLanguage::createInstance('configuration', 'framework');
$php_conf = ini_get_all();
$intest = '<div>' . '<div class="label_effect">';
$html = '<div class="conf_line_title">' . $lang->def('_SERVERINFO') . '</div>' . config_line($lang->def('_SERVER_ADDR'), $_SERVER['SERVER_ADDR']) . config_line($lang->def('_SERVER_PORT'), $_SERVER['SERVER_PORT']) . config_line($lang->def('_SERVER_NAME'), $_SERVER['SERVER_NAME']) . config_line($lang->def('_SERVER_ADMIN'), $_SERVER['SERVER_ADMIN']) . config_line($lang->def('_SERVER_SOFTWARE'), $_SERVER['SERVER_SOFTWARE']) . '<br />' . '<div class="conf_line_title">' . $lang->def('_SERVER_MYSQL') . '</div>' . config_line($lang->def('_MYSQL_VERS'), mysql_get_server_info()) . '<br />' . '<div class="conf_line_title">' . $lang->def('_PHPINFO') . '</div>' . config_line($lang->def('_PHPVERSION'), phpversion()) . config_line($lang->def('_SAFEMODE'), $php_conf['safe_mode']['local_value'] ? $lang->def('_ON') : $lang->def('_OFF')) . config_line($lang->def('_REGISTER_GLOBAL'), $php_conf['register_globals']['local_value'] ? $lang->def('_ON') : $lang->def('_OFF')) . config_line($lang->def('_MAGIC_QUOTES_GPC'), $php_conf['magic_quotes_gpc']['local_value'] ? $lang->def('_ON') : $lang->def('_OFF')) . config_line($lang->def('_UPLOAD_MAX_FILESIZE'), $php_conf['upload_max_filesize']['local_value']) . config_line($lang->def('_POST_MAX_SIZE'), $php_conf['post_max_size']['local_value']) . config_line($lang->def('_MAX_EXECUTION_TIME'), $php_conf['max_execution_time']['local_value'] . 's') . config_line($lang->def('_LDAP'), extension_loaded('ldap') ? $lang->def('_ON') : '<span class="font_red">' . $lang->def('_OFF') . ' ' . $lang->def('_USEFULL_ONLY_IF') . '</span>') . config_line($lang->def('_PHP_TIMEZONE'), @date_default_timezone_get());
if (version_compare(phpversion(), "5.0.0") == -1) {
echo config_line($lang->def('_DOMXML'), extension_loaded('domxml') ? $lang->def('_ON') : '<span class="font_red">' . $lang->def('_OFF') . ' (' . $lang->def('_NOTSCORM') . ')</span>');
}
if (version_compare(phpversion(), "5.2.0", ">")) {
echo config_line($lang->def('_ALLOW_URL_INCLUDE'), $php_conf['allow_url_include']['local_value'] ? '<span class="font_red">' . $lang->def('_ON') . '</span>' : $lang->def('_OFF'));
}
if (Get::cfg('uploadType') == 'ftp') {
if (function_exists("ftp_connect")) {
require_once _base_ . '/lib/lib.upload.php';
$re_con = sl_open_fileoperations();
echo config_line($lang->def('_UPLOADFTP'), $re_con ? $lang->def('_FTPOK') : '<span class="font_red">' . $lang->def('_FTPERR') . '</span>');
if ($re_con) {
sl_close_fileoperations();
}
} else {
echo config_line($lang->def('_UPLOADFTP'), '<span class="font_red">' . $lang->def('_FTPERR') . '</span>');
}
}
echo '<div class="nofloat"></div><br />';
return $html;
}
示例2: doIndex
/** server infomation **/
public function doIndex()
{
$db = $this->_mongo->selectDB("admin");
//command line
$query = $db->command(array("getCmdLineOpts" => 1));
if (isset($query["argv"])) {
$this->commandLine = implode(" ", $query["argv"]);
} else {
$this->commandLine = "";
}
//web server
$this->webServers = array();
if (isset($_SERVER["SERVER_SOFTWARE"])) {
list($webServer) = explode(" ", $_SERVER["SERVER_SOFTWARE"]);
$this->webServers["Web server"] = $webServer;
}
$this->webServers["<a href=\"http://www.php.net\" target=\"_blank\">PHP version</a>"] = "PHP " . PHP_VERSION;
$this->webServers["<a href=\"http://www.php.net/mongo\" target=\"_blank\">PHP extension</a>"] = "<a href=\"http://pecl.php.net/package/mongo\" target=\"_blank\">mongo</a>/" . RMongo::getVersion();
$this->directives = ini_get_all("mongo");
//build info
$ret = $db->command(array("buildinfo" => 1));
$this->buildInfos = array();
if ($ret["ok"]) {
unset($ret["ok"]);
$this->buildInfos = $ret;
}
//connection
$this->connections = array("Host" => $this->_server->mongoHost(), "Port" => $this->_server->mongoPort(), "Username" => "******", "Password" => "******");
$this->display();
}
示例3: get_smt2wp_diagnose_info
function get_smt2wp_diagnose_info()
{
$wp_base_dir = get_wp_base_dir();
$folders = array('server root' => $_SERVER['DOCUMENT_ROOT'], 'wp root' => $wp_base_dir, 'wp content' => $wp_base_dir . '/wp-content', 'wp uploads' => $wp_base_dir . '/wp-content/uploads', 'smt root' => $wp_base_dir . '/wp-content/plugins/' . basename(dirname(__FILE__)));
$folders_check_result = array();
foreach ($folders as $key => $folder) {
$folder = smt2wp_sanitize_dir_path($folder);
// var_dump($folder);
$folders_check_result[$key]['path'] = $folder;
$folders_check_result[$key]['permissions'] = base_convert(fileperms($folder), 10, 8);
// $folders_check_result[$key]['owner'] = posix_getpwuid(fileowner($folder));
$folders_check_result[$key]['owner_id'] = fileowner($folder);
// $folders_check_result[$key]['group'] = posix_getgrgid(filegroup($folder));
$folders_check_result[$key]['group_id'] = filegroup($folder);
// $folders_check_result[$key]['other_stats'] = stat($folder);
$folders_check_result[$key]['is_writable'] = is_writable($folder);
$test_folder = smt2wp_sanitize_dir_path($folder . '/test-348214');
$test_file = $test_folder . '/test-file-6542.txt';
$mkdir = mkdir($test_folder);
$put_contents = file_put_contents($test_file, 'this is just a test. you can delete this file');
$delete_file = unlink($test_file);
$rm_dir = rmdir($test_folder);
$folders_check_result[$key]['can_make_dir'] = $mkdir;
$folders_check_result[$key]['can_write_file'] = $put_contents === false ? false : true;
$folders_check_result[$key]['can_delete_file'] = $delete_file;
$folders_check_result[$key]['can_rm_dir'] = $rm_dir;
}
$all_ini_settings = ini_get_all();
$separator = '<<+>>';
$res = $separator . json_encode($folders_check_result);
$res .= $separator . json_encode($all_ini_settings);
// var_dump($all_ini_settings);
return $res;
}
示例4: __construct
function __construct()
{
$this->errors = array();
if (!function_exists('apc_cache_info')) {
$this->errors[] = "No cache info available. APC does not appear to be running. ";
$this->is_valid = false;
} else {
$this->time = time();
foreach (range(1, 10) as $i) {
self::$allowed_values['AGGR'][$i] = $i;
}
$this->host = getenv('HOSTNAME');
if ($this->host) {
$this->host = '(' . $this->host . ')';
}
$this->apc_all = ini_get_all('apc');
$this->cache_opcode = apc_cache_info('opcode', 1);
$this->cache_user = apc_cache_info('user', 1);
$this->sma_information = apc_sma_info();
$this->MYREQUEST = array();
$this->AUTHENTICATED = false;
$this->require_login = false;
$this->USE_INTERNAL_AUTHENTICATION = true;
$this->is_valid = true;
}
}
示例5: initPHPIniData
/**
* Load all PHP ini Data
*
* @param bool Always true as it can't be fail.
*/
protected static function initPHPIniData()
{
if (!empty(static::$phpIniData)) {
return true;
}
static::$phpIniData = ini_get_all();
return true;
}
示例6: getIniSettingsAsString
public static function getIniSettingsAsString()
{
$result = '';
$iniSettings = ini_get_all(null, false);
foreach ($iniSettings as $key => $value) {
$result .= sprintf('@ini_set(%s, %s);' . "\n", self::exportVariable($key), self::exportVariable($value));
}
return $result;
}
示例7: getOptions
function getOptions()
{
$options = array();
foreach (ini_get_all() as $name => $info) {
$parts = explode(".", $name);
$options[] = array(count($parts) == 1 ? "" : $parts[0], count($parts) == 1 ? $parts[0] : $parts[1], $info['global_value'], $info['local_value']);
}
return $options;
}
示例8: randomBytes
function randomBytes($length = 16, $secure = true, $raw = true, $startEntropy = "", &$rounds = 0, &$drop = 0)
{
static $lastRandom = "";
$output = "";
$length = abs((int) $length);
$secureValue = "";
$rounds = 0;
$drop = 0;
while (!isset($output[$length - 1])) {
//some entropy, but works ^^
$weakEntropy = array(is_array($startEntropy) ? implode($startEntropy) : $startEntropy, serialize(stat(__FILE__)), __DIR__, PHP_OS, microtime(), (string) lcg_value(), (string) PHP_MAXPATHLEN, PHP_SAPI, (string) PHP_INT_MAX . "." . PHP_INT_SIZE, serialize($_SERVER), serialize(get_defined_constants()), get_current_user(), serialize(ini_get_all()), (string) memory_get_usage() . "." . memory_get_peak_usage(), php_uname(), phpversion(), extension_loaded("gmp") ? gmp_strval(gmp_random(4)) : microtime(), zend_version(), (string) getmypid(), (string) getmyuid(), (string) mt_rand(), (string) getmyinode(), (string) getmygid(), (string) rand(), function_exists("zend_thread_id") ? (string) zend_thread_id() : microtime(), var_export(@get_browser(), true), function_exists("getrusage") ? @implode(getrusage()) : microtime(), function_exists("sys_getloadavg") ? @implode(sys_getloadavg()) : microtime(), serialize(get_loaded_extensions()), sys_get_temp_dir(), (string) disk_free_space("."), (string) disk_total_space("."), uniqid(microtime(), true), file_exists("/proc/cpuinfo") ? file_get_contents("/proc/cpuinfo") : microtime());
shuffle($weakEntropy);
$value = hash("sha512", implode($weakEntropy), true);
$lastRandom .= $value;
foreach ($weakEntropy as $k => $c) {
//mixing entropy values with XOR and hash randomness extractor
$value ^= hash("sha256", $c . microtime() . $k, true) . hash("sha256", mt_rand() . microtime() . $k . $c, true);
$value ^= hash("sha512", (string) lcg_value() . $c . microtime() . $k, true);
}
unset($weakEntropy);
if ($secure === true) {
$strongEntropyValues = array(is_array($startEntropy) ? hash("sha512", $startEntropy[($rounds + $drop) % count($startEntropy)], true) : hash("sha512", $startEntropy, true), file_exists("/dev/urandom") ? fread(fopen("/dev/urandom", "rb"), 64) : str_repeat("", 64), (function_exists("openssl_random_pseudo_bytes") and version_compare(PHP_VERSION, "5.3.4", ">=")) ? openssl_random_pseudo_bytes(64) : str_repeat("", 64), function_exists("mcrypt_create_iv") ? mcrypt_create_iv(64, MCRYPT_DEV_URANDOM) : str_repeat("", 64), $value);
$strongEntropy = array_pop($strongEntropyValues);
foreach ($strongEntropyValues as $value) {
$strongEntropy = $strongEntropy ^ $value;
}
$value = "";
//Von Neumann randomness extractor, increases entropy
$bitcnt = 0;
for ($j = 0; $j < 64; ++$j) {
$a = ord($strongEntropy[$j]);
for ($i = 0; $i < 8; $i += 2) {
$b = ($a & 1 << $i) > 0 ? 1 : 0;
if ($b != (($a & 1 << $i + 1) > 0 ? 1 : 0)) {
$secureValue |= $b << $bitcnt;
if ($bitcnt == 7) {
$value .= chr($secureValue);
$secureValue = 0;
$bitcnt = 0;
} else {
++$bitcnt;
}
++$drop;
} else {
$drop += 2;
}
}
}
}
$output .= substr($value, 0, min($length - strlen($output), $length));
unset($value);
++$rounds;
}
$lastRandom = hash("sha512", $lastRandom, true);
return $raw === false ? bin2hex($output) : $output;
}
示例9: doRuntimeInfoTable
public static function doRuntimeInfoTable($mem)
{
$s = APCUtils::tableHeader(wfMsg('viewapc-info-runtime'));
$r = 1;
foreach (ini_get_all('apc') as $k => $v) {
$s .= APCUtils::tableRow($r = 1 - $r, htmlspecialchars($k), str_replace(',', ',<br />', htmlspecialchars($v['local_value'])));
}
$s .= APCUtils::tableFooter();
return $s;
}
示例10: __construct
private final function __construct()
{
if (session_id()) {
session_unset();
session_destroy();
$_SESSION = array();
}
//Get all the ini settings to save time later
$ini = ini_get_all(null, false);
if ($ini['session.save_handler'] != 'files') {
//set default sessions save handler
ini_set('session.save_handler', 'files');
}
if ($ini['session.use_trans_sid'] != '0') {
//disable transparent sid support
ini_set('session.use_trans_sid', '0');
}
if ($ini['session.gc_probability'] != 15) {
//Clean up 15% of the time
ini_set('session.gc_probability', 15);
}
if ($ini['session.gc_divisor'] != 100) {
ini_set('session.gc_divisor', 100);
}
$cookie_domain = $GLOBALS['config']->get('config', 'cookie_domain');
if (!empty($cookie_domain) && strstr($GLOBALS['storeURL'], ltrim($cookie_domain, '.'))) {
ini_set('session.cookie_domain', $cookie_domain);
}
if (!$ini['session.cookie_path']) {
ini_set('session.cookie_path', $GLOBALS['rootRel']);
}
ini_set('session.cookie_httponly', true);
//If the current session time is longer we will not change anything
if ($ini['session.gc_maxlifetime'] < $this->_session_timeout) {
ini_set('session.gc_maxlifetime', $this->_session_timeout);
}
if ($ini['session.cookie_lifetime'] < $this->_session_timeout) {
ini_set('session.cookie_lifetime', $this->_session_timeout);
}
if (!$ini['session.use_cookies']) {
//Enforce cookies only
ini_set('session.use_cookies', true);
}
if (!$ini['session.use_only_cookies']) {
// make sure session is cookie based only
ini_set('session.use_only_cookies', true);
}
if (!$ini['session.cookie_httponly']) {
// make sure sesison cookies are http ONLY!
ini_set('session.cookie_httponly', true);
}
$this->_start();
$this->_validate();
$this->_setTimers();
}
示例11: bootstrap
/**
* @return array
*/
public function bootstrap()
{
$allowedKeys = array_keys(ini_get_all());
$changedSettings = array();
foreach ($this->settings as $key => $value) {
if (in_array($key, $allowedKeys)) {
ini_set($key, $value);
$changedSettings[$key] = $value;
}
}
return $changedSettings;
}
示例12: render
/**
* {@inheritdoc}
*/
protected function render()
{
$config = ini_get_all();
$maxLength = 0;
foreach ($config as $name => $value) {
$maxLength = max($maxLength, strlen($name));
}
foreach ($config as $name => $value) {
$name = str_pad($name, $maxLength, " ", STR_PAD_RIGHT);
$this->printText("<<3>>{$name} : <<0>>{$value["local_value"]}\n");
}
}
示例13: _setMessages
/**
* Set the messages specific to this test
*
*/
function _setMessages()
{
parent::_setMessages();
$this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', "force_redirect is enabled, which is the recommended setting");
$ini = ini_get_all();
if (isset($ini['cgi.force_redirect'])) {
$this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', "force_redirect is disabled. In most cases, this is a security vulnerability, but it appears this is not needed because you are running " . $this->skipTest());
$this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', "force_redirect is disabled. In most cases, this is a <strong>serious</strong> security vulnerability. Unless you are absolutely sure this is not needed, enable this setting");
} else {
$this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', "force_redirect is disabled because php was not compiled with --enable-force-cgi-redirect. In most cases, this is a security vulnerability, but it appears this is not needed because you are running " . $this->skipTest());
$this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', "force_redirect is disabled because php was not compiled with --enable-force-cgi-redirect. In most cases, this is a <strong>serious</strong> security vulnerability. Unless you are absolutely sure this is not needed, recompile php with --enable-force-cgi-redirect and enable cgi.force_redirect");
}
}
示例14: readDefaults
public static function readDefaults()
{
$iniSettings = ini_get_all('session', false);
$settings = [];
foreach ($iniSettings as $key => $value) {
$shortKey = str_replace('session.', '', $key);
$settings[$shortKey] = $value;
}
unset($iniSettings);
if (empty($settings['save_path'])) {
$settings['save_path'] = sys_get_temp_dir();
}
self::$_defaults = $settings;
}
示例15: setParam
/**
* @public
*/
function setParam($sessionName = '', $sessionExpire = 0)
{
$allIniArray = ini_get_all();
if ($sessionName != '') {
$this->mSessionName = $sessionName;
} else {
$this->mSessionName = $allIniArray['session.name']['global_value'];
}
if (!empty($sessionExpire)) {
$this->mSessionLifetime = 60 * $sessionExpire;
} else {
$this->mSessionLifetime = $allIniArray['session.cookie_lifetime']['global_value'];
}
}