當前位置: 首頁>>代碼示例>>PHP>>正文


PHP php_ini_loaded_file函數代碼示例

本文整理匯總了PHP中php_ini_loaded_file函數的典型用法代碼示例。如果您正苦於以下問題:PHP php_ini_loaded_file函數的具體用法?PHP php_ini_loaded_file怎麽用?PHP php_ini_loaded_file使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了php_ini_loaded_file函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: extract

 protected function extract($file, $path)
 {
     $processError = null;
     // try to use unzip on *nix
     if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
         $command = 'unzip ' . escapeshellarg($file) . ' -d ' . escapeshellarg($path);
         if (0 === $this->process->execute($command, $ignoredOutput)) {
             return;
         }
         $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
     }
     if (!class_exists('ZipArchive')) {
         // php.ini path is added to the error message to help users find the correct file
         $iniPath = php_ini_loaded_file();
         if ($iniPath) {
             $iniMessage = 'The php.ini used by your command-line PHP is: ' . $iniPath;
         } else {
             $iniMessage = 'A php.ini file does not exist. You will have to create one.';
         }
         $error = "Could not decompress the archive, enable the PHP zip extension or install unzip.\n" . $iniMessage . "\n" . $processError;
         if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
             $error = "Could not decompress the archive, enable the PHP zip extension.\n" . $iniMessage;
         }
         throw new \RuntimeException($error);
     }
     $zipArchive = new ZipArchive();
     if (true !== ($retval = $zipArchive->open($file))) {
         throw new \UnexpectedValueException($this->getErrorMessage($retval, $file));
     }
     if (true !== $zipArchive->extractTo($path)) {
         throw new \RuntimeException("There was an error extracting the ZIP file. Corrupt file?");
     }
     $zipArchive->close();
 }
開發者ID:ilosada,項目名稱:chamilo-lms-icpna,代碼行數:34,代碼來源:ZipDownloader.php

示例2: newsletter_start_commandline_sending

/**
 * Start the commandline to send a newsletter
 * This is offloaded because it could take a while and/or resources
 *
 * @param Newsletter $entity Newsletter entity to be processed
 *
 * @return void
 */
function newsletter_start_commandline_sending(Newsletter $entity)
{
    if (!empty($entity) && elgg_instanceof($entity, "object", Newsletter::SUBTYPE)) {
        // prepare commandline settings
        $settings = array("entity_guid" => $entity->getGUID(), "host" => $_SERVER["HTTP_HOST"], "memory_limit" => ini_get("memory_limit"), "secret" => newsletter_generate_commanline_secret($entity->getGUID()));
        if (isset($_SERVER["HTTPS"])) {
            $settings["https"] = $_SERVER["HTTPS"];
        }
        // ini settings
        $ini_param = "";
        $ini_file = php_ini_loaded_file();
        if (!empty($ini_file)) {
            $ini_param = "-c " . $ini_file . " ";
        }
        // which script to run
        $script_location = dirname(dirname(__FILE__)) . "/procedures/cli.php";
        // convert settings to commandline params
        $query_string = http_build_query($settings, "", " ");
        // start the correct commandline
        if (PHP_OS === "WINNT") {
            pclose(popen("start /B php " . $ini_param . $script_location . " " . $query_string, "r"));
        } else {
            exec("php " . $ini_param . $script_location . " " . $query_string . " > /dev/null &");
        }
    }
}
開發者ID:pleio,項目名稱:newsletter,代碼行數:34,代碼來源:functions.php

示例3: execute

 /**
  * Execute the "show" command
  *
  * @param  InputInterface $input Input object
  * @param  OutputInterface $output Output object
  * @throws \Exception
  * @return null
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $input->getOption('path');
     // if we're not given a path at all, try to figure it out
     if ($path === null) {
         $path = php_ini_loaded_file();
     }
     if (!is_file($path)) {
         throw new \Exception('Path is null or not accessible: "' . $path . '"');
     }
     $ini = parse_ini_file($path, true);
     $output->writeLn('Current PHP.ini settings from ' . $path);
     $output->writeLn('##########');
     foreach ($ini as $section => $data) {
         $output->writeLn('<info>:: ' . $section . '</info>');
         if (empty($data)) {
             $output->writeLn("\t<fg=yellow>No settings</fg=yellow>");
         } else {
             foreach ($data as $path => $value) {
                 $output->writeLn("\t" . $path . ' => ' . var_export($value, true));
             }
         }
         $output->writeLn("-----------------\n");
     }
 }
開發者ID:giuseppemorelli,項目名稱:iniscan,代碼行數:33,代碼來源:ShowCommand.php

示例4: newsletter_start_commandline_sending

/**
 * Start the commandline to send a newsletter
 * This is offloaded because it could take a while and/or resources
 *
 * @param Newsletter $entity Newsletter entity to be processed
 *
 * @return void
 */
function newsletter_start_commandline_sending(Newsletter $entity)
{
    if (!elgg_instanceof($entity, 'object', Newsletter::SUBTYPE)) {
        return;
    }
    // prepare commandline settings
    $settings = ['entity_guid' => $entity->getGUID(), 'host' => $_SERVER['HTTP_HOST'], 'memory_limit' => ini_get('memory_limit'), 'secret' => newsletter_generate_commanline_secret($entity->getGUID())];
    if (isset($_SERVER['HTTPS'])) {
        $settings['https'] = $_SERVER['HTTPS'];
    }
    // ini settings
    $ini_param = '';
    $ini_file = php_ini_loaded_file();
    if (!empty($ini_file)) {
        $ini_param = "-c {$ini_file} ";
    }
    // which script to run
    $script_location = dirname(dirname(__FILE__)) . '/procedures/cli.php';
    // convert settings to commandline params
    $query_string = http_build_query($settings, '', ' ');
    // start the correct commandline
    if (PHP_OS === 'WINNT') {
        pclose(popen('start /B php ' . $ini_param . $script_location . ' ' . $query_string, 'r'));
    } else {
        exec('php ' . $ini_param . $script_location . ' ' . $query_string . ' > /dev/null &');
    }
}
開發者ID:coldtrick,項目名稱:newsletter,代碼行數:35,代碼來源:functions.php

示例5: install

 /**
  * Install extension by given name.
  *
  * Uses configration retrieved as per `php_ini_loaded_file()`.
  *
  * @see http://php.net/php_ini_loaded_file
  * @param string $name The name of the extension to install.
  * @return void
  */
 public static function install($name)
 {
     if (!isset(static::$_extensions[$name])) {
         return;
     }
     $extension = static::$_extensions[$name];
     echo $name;
     if (isset($extension['require']['php'])) {
         $version = $extension['require']['php'];
         if (!version_compare(PHP_VERSION, $version[1], $version[0])) {
             $message = " => not installed, requires a PHP version %s %s (%s installed)\n";
             printf($message, $version[0], $version[1], PHP_VERSION);
             return;
         }
     }
     static::_system(sprintf('wget %s > /dev/null 2>&1', $extension['url']));
     $file = basename($extension['url']);
     static::_system(sprintf('tar -xzf %s > /dev/null 2>&1', $file));
     $folder = basename($file, '.tgz');
     $folder = basename($folder, '.tar.gz');
     $message = 'sh -c "cd %s && phpize && ./configure %s ';
     $message .= '&& make && sudo make install" > /dev/null 2>&1';
     static::_system(sprintf($message, $folder, implode(' ', $extension['configure'])));
     foreach ($extension['ini'] as $ini) {
         static::_system(sprintf("echo %s >> %s", $ini, php_ini_loaded_file()));
     }
     printf("=> installed (%s)\n", $folder);
 }
開發者ID:bruensicke,項目名稱:li3_redis,代碼行數:37,代碼來源:ci_depends.php

示例6: __construct

 public function __construct()
 {
     parent::__construct();
     //
     // Make sure that bool valued settings are cast to ints.
     //
     $this->_settings = array(self::ALLOW_USER_REGISTRATION => 1, self::EXECUTABLE_TAR => Framework_HostOs::isWindows() ? '' : 'tar', self::EXECUTABLE_GIT => 'git' . (Framework_HostOs::isWindows() ? '.exe' : ''), self::EXECUTABLE_PHP => 'php' . (Framework_HostOs::isWindows() ? '.exe' : '') . (php_ini_loaded_file() ? ' -c ' . htmlentities(str_replace(array('\\', '//'), '/', php_ini_loaded_file())) : ''), self::EXECUTABLE_SVN => 'svn' . (Framework_HostOs::isWindows() ? '.exe' : ''), self::INTERNAL_BUILDER_ACTIVE => CINTIENT_INTERNAL_BUILDER_ACTIVE, self::VERSION => '');
 }
開發者ID:rasismeiro,項目名稱:cintient,代碼行數:8,代碼來源:SystemSettings.php

示例7: getIniPath

 public function getIniPath()
 {
     $ini = php_ini_loaded_file();
     if (!$ini && file_exists('/etc/hhvm/php.ini')) {
         $ini = '/etc/hhvm/php.ini';
     }
     return $ini;
 }
開發者ID:staabm,項目名稱:pickle,代碼行數:8,代碼來源:HHVM.php

示例8: iniCheck

 public function iniCheck($info, $setting, $expected, $required = true, $help = null)
 {
     $current = ini_get($setting);
     $cb = function () use($current, $expected) {
         return is_callable($expected) ? call_user_func($expected, $current) : $current == $expected;
     };
     $message = sprintf('%s in %s is currently set to %s but %s be set to %s.', $setting, php_ini_loaded_file(), var_export($current, true), $required ? 'must' : 'should', var_export($expected, true)) . ' ' . $help;
     $this->check($info, $cb, trim($message), $required);
 }
開發者ID:myrichhub,項目名稱:mssapi_php,代碼行數:9,代碼來源:compatibility-test.php

示例9: setDirective

 /**
  * @param string $section
  */
 public static function setDirective($section, $directive, $value)
 {
     $ini_file = php_ini_loaded_file();
     self::doBackup($ini_file);
     $ini = new INIReaderWriter($ini_file);
     $ini->set($section, $directive, $value);
     $ini->write($ini_file);
     return true;
 }
開發者ID:siltronicz,項目名稱:webinterface,代碼行數:12,代碼來源:PHPINI.php

示例10: execute

 public function execute()
 {
     $file = php_ini_loaded_file();
     if (!file_exists($file)) {
         $php = Config::getCurrentPhpName();
         $this->logger->warn("Sorry, I can't find the {$file} file for php {$php}.");
         return;
     }
     Utils::editor($file);
 }
開發者ID:phpbrew,項目名稱:phpbrew,代碼行數:10,代碼來源:ConfigCommand.php

示例11: createInterpreter

/** @return Tester\Runner\PhpInterpreter */
function createInterpreter()
{
    if (defined('HHVM_VERSION')) {
        return new Tester\Runner\HhvmPhpInterpreter(PHP_BINARY);
    } elseif (defined('PHPDBG_VERSION')) {
        return new Tester\Runner\ZendPhpDbgInterpreter(PHP_BINARY, ' -c ' . Tester\Helpers::escapeArg(php_ini_loaded_file()));
    } else {
        return new Tester\Runner\ZendPhpInterpreter(PHP_BINARY, ' -c ' . Tester\Helpers::escapeArg(php_ini_loaded_file()));
    }
}
開發者ID:re1la2pse,項目名稱:detinsky_projekt,代碼行數:11,代碼來源:bootstrap.php

示例12: getAll

 /**
  * 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;
 }
開發者ID:Rudloff,項目名稱:composer,代碼行數:18,代碼來源:IniHelper.php

示例13: getEnvironment

 public static function getEnvironment(Context $context)
 {
     $environment = [];
     $environment['server'] = ['title' => _i('Server Information'), 'data' => [['title' => _i('Web Server Software'), 'value' => $_SERVER['SERVER_SOFTWARE'], 'alert' => ['type' => 'warning', 'condition' => (bool) preg_match('/nginx/i', $_SERVER['SERVER_SOFTWARE']), 'title' => 'Warning', 'string' => _i('The nginx web server has its own internal file size limit variable for uploads. It is recommended that this value be set at the same value set in the PHP configuration file.')]], ['title' => _i('PHP Version'), 'value' => PHP_VERSION, 'alert' => ['type' => 'important', 'condition' => version_compare(PHP_VERSION, '5.4.0') < 0, 'title' => _i('Please Update Immediately'), 'string' => _i('The minimum requirements to run this software is 5.4.0.')]]]];
     $environment['software'] = ['title' => _i('Software Information'), 'data' => [['title' => _i('FoolFrame Version'), 'value' => $context->getService('config')->get('foolz/foolframe', 'package', 'main.version'), 'alert' => ['type' => 'info', 'condition' => true, 'title' => _i('New Update Available'), 'string' => _i('There is a new version of the software available for download.')]]]];
     $environment['php-configuration'] = ['title' => _i('PHP Configuration'), 'data' => [['title' => _i('Config Location'), 'value' => php_ini_loaded_file(), 'description' => _i('This is the path to the location of the php.ini configuration file.')], ['title' => 'allow_url_fopen', 'value' => ini_get('allow_url_fopen') ? _i('On') : _i('Off'), 'description' => _i('This option enables the URL-aware fopen wrappers that allows access to remote files using the FTP or HTTP protocol.'), 'alert' => ['type' => 'important', 'condition' => (bool) (!ini_get('allow_url_fopen')), 'title' => _i('Critical'), 'string' => _i('The PHP configuration on the server currently has URL-aware fopen wrappers disabled. The software will be operating at limited functionality.')]], ['title' => 'max_execution_time', 'value' => ini_get('max_execution_time'), 'description' => _i('This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.'), 'alert' => ['type' => 'warning', 'condition' => (bool) (intval(ini_get('max_execution_time')) < 60), 'title' => _i('Warning'), 'string' => _i('Your current value for maximum execution time is below the suggested value.')]], ['title' => 'file_uploads', 'value' => ini_get('file_uploads') ? _i('On') : _i('Off'), 'description' => _i('This sets whether or not to allow HTTP file uploads.'), 'alert' => ['type' => 'important', 'condition' => (bool) (!ini_get('file_uploads')), 'title' => _i('Critical'), 'string' => _i('The PHP configuration on the server currently has file uploads disabled. This option must be enabled for the software to fully function.')]], ['title' => 'post_max_size', 'value' => ini_get('post_max_size'), 'description' => _i('This sets the maximum size of POST data allowed.'), 'alert' => ['type' => 'warning', 'condition' => (bool) (intval(substr(ini_get('post_max_size'), 0, -1)) < 16), 'title' => _i('Warning'), 'string' => _i('Your current value for maximum POST data size is below the suggested value.')]], ['title' => 'upload_max_filesize', 'value' => ini_get('upload_max_filesize'), 'description' => _i('This sets the maximum size allowed to be uploaded.'), 'alert' => ['type' => 'warning', 'condition' => (bool) (intval(substr(ini_get('upload_max_filesize'), 0, -1)) < 16), 'title' => _i('Warning'), 'string' => _i('Your current value for maximum upload file size is below the suggested value.')]], ['title' => 'max_file_uploads', 'value' => ini_get('max_file_uploads'), 'description' => _i('This sets the maximum number of files allowed to be uploaded concurrently.'), 'alert' => ['type' => 'warning', 'condition' => (bool) (intval(ini_get('max_file_uploads')) < 60), 'title' => _i('Warning'), 'string' => _i('Your current value for maximum number of concurrent uploads is below the suggested value.')]]]];
     $environment['php-extensions'] = ['title' => _i('PHP Extensions'), 'data' => [['title' => 'APC', 'value' => extension_loaded('apc') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'warning', 'condition' => (bool) (!extension_loaded('apc')), 'title' => _i('Warning'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'APC')]], ['title' => 'cURL', 'value' => extension_loaded('curl') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('curl')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'cURL')]], ['title' => 'FileInfo', 'value' => extension_loaded('fileinfo') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('fileinfo')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'FileInfo')]], ['title' => 'JSON', 'value' => extension_loaded('json') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('json')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'JSON')]], ['title' => 'Multi-byte String', 'value' => extension_loaded('mbstring') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('mbstring')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'Multi-byte String')]], ['title' => 'MySQLi', 'value' => extension_loaded('mysqli') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('mysqli')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'MySQLi')]], ['title' => 'PDO MySQL', 'value' => extension_loaded('pdo_mysql') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('pdo_mysql')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'PDO MySQL')]]]];
     $environment = Hook::forge('Foolz\\FoolFrame\\Model\\System::getEnvironment#var.environment')->setParam('environment', $environment)->execute()->get($environment);
     usort($environment['php-extensions']['data'], array('System', 'sortByTitle'));
     return $environment;
 }
開發者ID:KasaiDot,項目名稱:FoolFrame,代碼行數:11,代碼來源:System.php

示例14: collectConfigurationFiles

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;
}
開發者ID:Hensyy,項目名稱:mysite,代碼行數:11,代碼來源:_intellij_phpdebug_validator.php

示例15: vtiger_extensionloader_suggest

 function vtiger_extensionloader_suggest()
 {
     $PHPVER = sprintf("%s.%s", PHP_MAJOR_VERSION, PHP_MINOR_VERSION);
     $OSHWINFO = str_replace('Darwin', 'Mac', PHP_OS) . '_' . php_uname('m');
     $WIN = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? true : false;
     $EXTFNAME = 'vtigerextn_loader';
     $EXTNFILE = $EXTFNAME . ($WIN ? '.dll' : '.so');
     $DISTFILE = sprintf("%s_%s_%s.so", $EXTFNAME, $PHPVER, $OSHWINFO);
     $DISTFILEZIP = sprintf("%s_%s_%s-yyyymmdd.zip", $EXTFNAME, $PHPVER, $OSHWINFO);
     return array('loader_zip' => $DISTFILEZIP, 'loader_file' => $DISTFILE, 'php_ini' => php_ini_loaded_file(), 'extensions_dir' => ini_get('extension_dir'));
 }
開發者ID:cannking,項目名稱:vtigercrm-debug,代碼行數:11,代碼來源:LoaderSuggest.php


注:本文中的php_ini_loaded_file函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。