当前位置: 首页>>代码示例>>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;未经允许,请勿转载。