当前位置: 首页>>代码示例>>PHP>>正文


PHP is_executable函数代码示例

本文整理汇总了PHP中is_executable函数的典型用法代码示例。如果您正苦于以下问题:PHP is_executable函数的具体用法?PHP is_executable怎么用?PHP is_executable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_executable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor
  *
  * @param   string command default NULL
  * @param   string[] arguments default []
  * @param   string cwd default NULL the working directory
  * @param   [:string] default NULL the environment
  * @throws  io.IOException in case the command could not be executed
  */
 public function __construct($command = NULL, $arguments = array(), $cwd = NULL, $env = NULL)
 {
     static $spec = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
     // For `new self()` used in getProcessById()
     if (NULL === $command) {
         return;
     }
     // Check whether the given command is executable.
     $binary = self::resolve($command);
     if (!is_file($binary) || !is_executable($binary)) {
         throw new IOException('Command "' . $binary . '" is not an executable file');
     }
     // Open process
     $cmd = CommandLine::forName(PHP_OS)->compose($binary, $arguments);
     if (!is_resource($this->_proc = proc_open($cmd, $spec, $pipes, $cwd, $env, array('bypass_shell' => TRUE)))) {
         throw new IOException('Could not execute "' . $cmd . '"');
     }
     $this->status = proc_get_status($this->_proc);
     $this->status['exe'] = $binary;
     $this->status['arguments'] = $arguments;
     $this->status['owner'] = TRUE;
     // Assign in, out and err members
     $this->in = new File($pipes[0]);
     $this->out = new File($pipes[1]);
     $this->err = new File($pipes[2]);
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:35,代码来源:Process.class.php

示例2: find

 public function find()
 {
     if (defined('HHVM_VERSION') && false !== ($hhvm = getenv('PHP_BINARY'))) {
         return $hhvm;
     }
     if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server')) && is_file(PHP_BINARY)) {
         return PHP_BINARY;
     }
     if ($php = getenv('PHP_PATH')) {
         if (!is_executable($php)) {
             return false;
         }
         return $php;
     }
     if ($php = getenv('PHP_PEAR_PHP_BIN')) {
         if (is_executable($php)) {
             return $php;
         }
     }
     $dirs = array(PHP_BINDIR);
     if (defined('PHP_WINDOWS_VERSION_BUILD')) {
         $dirs[] = 'C:\\xampp\\php\\';
     }
     return $this->executableFinder->find('php', false, $dirs);
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:25,代码来源:PhpExecutableFinder.php

示例3: tex_filter_get_executable

function tex_filter_get_executable($debug = false)
{
    global $CFG;
    $error_message1 = "Your system is not configured to run mimeTeX. You need to download the appropriate<br />" . "executable for you " . PHP_OS . " platform from <a href=\"http://moodle.org/download/mimetex/\">" . "http://moodle.org/download/mimetex/</a>, or obtain the C source<br /> " . "from <a href=\"http://www.forkosh.com/mimetex.zip\">" . "http://www.forkosh.com/mimetex.zip</a>, compile it and " . "put the executable into your<br /> moodle/filter/tex/ directory.";
    $error_message2 = "Custom mimetex is not executable!<br /><br />";
    if (PHP_OS == "WINNT" || PHP_OS == "WIN32" || PHP_OS == "Windows") {
        return "{$CFG->dirroot}/filter/tex/mimetex.exe";
    }
    $custom_commandpath = "{$CFG->dirroot}/filter/tex/mimetex";
    if (file_exists($custom_commandpath)) {
        if (is_executable($custom_commandpath)) {
            return $custom_commandpath;
        } else {
            error($error_message2 . $error_message1);
        }
    }
    switch (PHP_OS) {
        case "Linux":
            return "{$CFG->dirroot}/filter/tex/mimetex.linux";
        case "Darwin":
            return "{$CFG->dirroot}/filter/tex/mimetex.darwin";
        case "FreeBSD":
            return "{$CFG->dirroot}/filter/tex/mimetex.freebsd";
    }
    error($error_message1);
}
开发者ID:r007,项目名称:PMoodle,代码行数:26,代码来源:lib.php

示例4: find

 public function find($includeArgs = true)
 {
     if (defined('HHVM_VERSION')) {
         return (false !== ($hhvm = getenv('PHP_BINARY')) ? $hhvm : PHP_BINARY) . ($includeArgs ? ' ' . implode(' ', $this->findArguments()) : '');
     }
     if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server')) && is_file(PHP_BINARY)) {
         return PHP_BINARY;
     }
     if ($php = getenv('PHP_PATH')) {
         if (!is_executable($php)) {
             return false;
         }
         return $php;
     }
     if ($php = getenv('PHP_PEAR_PHP_BIN')) {
         if (is_executable($php)) {
             return $php;
         }
     }
     $dirs = array(PHP_BINDIR);
     if ('\\' === DIRECTORY_SEPARATOR) {
         $dirs[] = 'C:\\xampp\\php\\';
     }
     return $this->executableFinder->find('php', false, $dirs);
 }
开发者ID:VicDeo,项目名称:poc,代码行数:25,代码来源:PhpExecutableFinder.php

示例5: __construct

 public function __construct($tool = null)
 {
     $this->tool = $tool ?: $this->tool;
     if (!is_file($this->tool) || !is_executable($this->tool)) {
         throw new ErrorException("Invalid ffmpeg tool location: {$this->tool}");
     }
 }
开发者ID:voituk,项目名称:Misc,代码行数:7,代码来源:FFMpeg.class.php

示例6: __exec

 /**
  * Try to locate the program
  * @param string $program
  * @return string
  *
  * @access protected
  */
 function __exec($program)
 {
     // safe mode ?
     //
     if (!ini_get('safe_mode') || !($path = ini_get('safe_mode_exec_dir'))) {
         ($path = getenv('PATH')) || ($path = getenv('Path'));
     }
     $executable = false;
     $p = explode(PATH_SEPARATOR, $path);
     $p[] = getcwd();
     $ext = array();
     if (OS_WINDOWS) {
         $ext = getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com');
         // extension ?
         //
         array_unshift($ext, '');
     }
     // walk the variants
     //
     foreach ($ext as $e) {
         foreach ($p as $dir) {
             $exe = $dir . DIRECTORY_SEPARATOR . $program . $e;
             // *nix only implementation
             //
             if (OS_WINDOWS ? is_file($exe) : is_executable($exe)) {
                 $executable = $exe;
                 break;
             }
         }
     }
     return $executable;
 }
开发者ID:kktsvetkov,项目名称:asido,代码行数:39,代码来源:class.driver.shell.php

示例7: findDirs

/**
 * Returns an array of found directories
 *
 * This function checks every found directory if they match either $uid or $gid, if they do
 * the found directory is valid. It uses recursive function calls to find subdirectories. Due
 * to the recursive behauviour this function may consume much memory.
 *
 * @param  string   path       The path to start searching in
 * @param  integer  uid        The uid which must match the found directories
 * @param  integer  gid        The gid which must match the found direcotries
 * @param  array    _fileList  recursive transport array !for internal use only!
 * @return array    Array of found valid pathes
 *
 * @author Martin Burchert  <martin.burchert@syscp.de>
 * @author Manuel Bernhardt <manuel.bernhardt@syscp.de>
 */
function findDirs($path, $uid, $gid)
{
    $list = array($path);
    $_fileList = array();
    while (sizeof($list) > 0) {
        $path = array_pop($list);
        $path = makeCorrectDir($path);
        if (!is_readable($path) || !is_executable($path)) {
            //return $_fileList;
            // only 'skip' this directory, #611
            continue;
        }
        $dh = opendir($path);
        if ($dh === false) {
            /*
             * this should never be called because we checked
             * 'is_readable' before...but we never know what might happen
             */
            standard_error('cannotreaddir', $path);
            return null;
        } else {
            while (false !== ($file = @readdir($dh))) {
                if ($file == '.' && (fileowner($path . '/' . $file) == $uid || filegroup($path . '/' . $file) == $gid)) {
                    $_fileList[] = makeCorrectDir($path);
                }
                if (is_dir($path . '/' . $file) && $file != '..' && $file != '.') {
                    array_push($list, $path . '/' . $file);
                }
            }
            @closedir($dh);
        }
    }
    return $_fileList;
}
开发者ID:Git-Host,项目名称:Froxlor,代码行数:50,代码来源:function.findDirs.php

示例8: checkByCrackLib

 function checkByCrackLib($password)
 {
     $cl = $this->api->getConfig('cracklib', null);
     if ($cl === null) {
         if (is_executable($t = '/usr/sbin/cracklib-check')) {
             $cl = $t;
         } elseif (is_executable($t = '/usr/local/sbin/cracklib-check')) {
             $cl = $t;
         } else {
             $cl = false;
         }
     }
     $password = str_replace("\r", "", $password);
     $password = str_replace("\n", "", $password);
     if ($cl && file_exists($cl) && is_executable($cl)) {
         $cl = $this->add('System_ProcessIO')->exec($cl)->write_all($password);
         $out = trim($cl->read_all());
         $out = str_replace($password, '', $out);
         $out = preg_replace('/^:\\s*/', '', $out);
         if ($out == 'OK') {
             return true;
         }
         return $out;
     } else {
         if (strlen($password) < 4) {
             return "it is WAY too short";
         }
         if (strlen($password) < 6) {
             return "it is too short";
         }
         return true;
     }
 }
开发者ID:samratcis,项目名称:atk4,代码行数:33,代码来源:Advanced.php

示例9: find_binary

 /**
  * Return the path to an executable version of the named binary, or null.
  * The paths are traversed in the following order:
  *   1. $priority_path (if specified)
  *   2. Gallery's own bin directory (DOCROOT . "bin")
  *   3. PATH environment variable
  *   4. extra_binary_paths Gallery variable (if specified)
  * In addition, if the file is found inside Gallery's bin directory but
  * it's not executable, we try to change its permissions to 0755.
  *
  * @param  string $binary
  * @param  string $priority_path (optional)
  * @return string path to binary if found; null if not found
  */
 static function find_binary($binary, $priority_path = null)
 {
     $bin_path = DOCROOT . "bin";
     if ($priority_path) {
         $paths = array($priority_path, $bin_path);
     } else {
         $paths = array($bin_path);
     }
     $paths = array_merge($paths, explode(":", getenv("PATH")), explode(":", module::get_var("gallery", "extra_binary_paths")));
     foreach ($paths as $path) {
         $path = rtrim($path, "/");
         $candidate = "{$path}/{$binary}";
         // @suppress errors below to avoid open_basedir issues
         if (@file_exists($candidate)) {
             if (!@is_executable($candidate) && substr_compare($bin_path, $candidate, 0, strlen($bin_path)) == 0) {
                 // Binary isn't executable but is in Gallery's bin directory - try fixing permissions.
                 @chmod($candidate, 0755);
             }
             if (@is_executable($candidate)) {
                 return $candidate;
             }
         }
     }
     return null;
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:39,代码来源:system.php

示例10: system_check_find_path

function system_check_find_path($command)
{
    $is_windows = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
    if (!defined('PATH_SEPARATOR')) {
        $path_sep = $is_windows ? ':' : ';';
    } else {
        $path_sep = PATH_SEPARATOR;
    }
    $path = getenv('PATH');
    $path_array = explode($path_sep, $path);
    $pathext = $is_windows ? strtolower($_SERVER['PATHEXT']) : '';
    $ext_array = explode(';', $pathext);
    $file_sep = $is_windows ? '\\' : '/';
    $found = false;
    clearstatcache();
    foreach ($path_array as $p) {
        if (substr($p, -1) === $file_sep) {
            $p = substr($p, 0, strlen($p) - 1);
        }
        foreach ($ext_array as $e) {
            $full_path = $p . $file_sep . $command . $e;
            if (file_exists($full_path)) {
                if (is_file($full_path) && ($is_windows || is_executable($full_path))) {
                    $found = $full_path;
                    break;
                }
            }
        }
    }
    return $found;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:31,代码来源:system_check_test_command.php

示例11: setDefaults

    /**
     * Set Container Defaults
     *
     * This is where we set all our defaults. If you need to customise this
     * container this is a good place to look to see what can be configured
     * and how to configure it.
     */
    protected function setDefaults()
    {
        $this->binary = function () {
            if (is_dir(__DIR__ . '/../../../vendor')) {
                $bin = __DIR__ . '/../../../vendor/bin/phantomjs';
            } else {
                $bin = __DIR__ . '/../../../../bin/phantomjs';
            }
            if (!is_executable($bin)) {
                throw new RuntimeException('The phantomjs command ("' . $bin . '") ' . 'was not found or is not executable by the current user! ');
            }
            return realpath($bin);
        };
        $this->runner = __DIR__ . '/Phantom.js';
        $this->process = $this->protect(function ($cmd) {
            return new Process($cmd);
        });
        $this->tempFile = $this->protect(function () {
            return new TempFile('GearsPdf', 'pdf');
        });
        $this->printFramework = function () {
            return '
				<style>' . file_get_contents(__DIR__ . '/Print.css') . '</style>
				<script>' . file_get_contents(__DIR__ . '/isVisible.js') . '</script>
				<script>' . file_get_contents(__DIR__ . '/jQuery.js') . '</script>
				<script>' . file_get_contents(__DIR__ . '/Print.js') . '</script>
			';
        };
    }
开发者ID:lucagtc,项目名称:pdf,代码行数:36,代码来源:Backend.php

示例12: status

 /**
  * Displays information about the system configuration.
  */
 public function status()
 {
     $this->set('core', array('debug' => Configure::read('debug'), 'database' => @ConnectionManager::getDataSource('default')));
     $uploads_path = Configure::read('uploads.path');
     $this->set('uploads', array('url' => Configure::read('uploads.url'), 'path' => $uploads_path, 'exists' => is_dir($uploads_path), 'writable' => is_writable($uploads_path), 'executable' => is_executable($uploads_path)));
     $this->set('dependencies', array('Ghostscript' => is_executable('ghostscript'), 'Imagemagick' => class_exists('Imagick')));
 }
开发者ID:ndreynolds,项目名称:arcs,代码行数:10,代码来源:AdminController.php

示例13: doRepositoryTest

 function doRepositoryTest($repo)
 {
     if ($repo->accessType != "ssh") {
         return -1;
     }
     $basePath = "../../../plugins/access.ssh/";
     // Check file exists
     if (!file_exists($basePath . "class.sshAccessDriver.php") || !file_exists($basePath . "class.SSHOperations.php") || !file_exists($basePath . "manifest.xml") || !file_exists($basePath . "showPass.php") || !file_exists($basePath . "sshActions.xml")) {
         $this->failedInfo .= "Missing at least one of the plugin files (class.sshDriver.php, class.SSHOperations.php, manifest.xml, showPass.php, sshActions.xml).\nPlease reinstall from lastest release.";
         return FALSE;
     }
     // Check if showPass is executable from ssh
     $stat = stat($basePath . "showPass.php");
     $mode = $stat['mode'] & 0x7fff;
     // We don't care about the type
     if (!is_executable($basePath . 'showPass.php') && ($mode & 0x40 && $stat['uid'] == posix_getuid()) && ($mode & 0x8 && $stat['gid'] == posix_getgid()) && $mode & 0x1) {
         chmod($basePath . 'showPass.php', 0555);
         if (!is_executable($basePath . 'showPass.php')) {
             $this->failedInfo .= "showPass.php must be executable. Please log in on your server and set showPass.php as executable (chmod u+x showPass.php).";
             return FALSE;
         }
     }
     // Check if ssh is accessible
     $handle = popen("ssh 2>&1", "r");
     $usage = fread($handle, 30);
     pclose($handle);
     if (strpos($usage, "usage") === FALSE) {
         $this->failedInfo .= "Couldn't find or execute 'ssh' on your system. Please install latest SSH client.";
         return FALSE;
     }
     return TRUE;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:32,代码来源:test.sshAccess.php

示例14: execute

 protected function execute($arguments = array(), $options = array())
 {
     $app = $arguments['application'];
     $env = $options['env'];
     if (!is_executable($options['java'])) {
         throw new sfException('Please provide a valid java executable file');
     }
     $this->java = $options['java'];
     if (!is_executable($options['nohup'])) {
         throw new sfException('Please provide a valid nohup executable file');
     }
     $this->nohup = $options['nohup'];
     $action = $arguments['action'];
     switch ($action) {
         case 'start':
             $this->start($app, $env, $options);
             break;
         case 'stop':
             $this->stop($app, $env, $options);
             break;
         case 'restart':
             $this->stop($app, $env, $options);
             $this->start($app, $env, $options);
             break;
         case 'status':
             $this->status($app, $env, $options);
             break;
     }
 }
开发者ID:rande,项目名称:sfSolrPlugin,代码行数:29,代码来源:sfLuceneServiceTask.class.php

示例15: __construct

 public function __construct($gnokiiPath)
 {
     if (!is_executable($this->gnokiiPath)) {
         throw new \Exception('Specified Gnokii executable is not executable by me!');
     }
     $this->gnokiiPath = $gnokiiPath;
 }
开发者ID:gergelypolonkai,项目名称:smsgateway,代码行数:7,代码来源:GnokiiSender.php


注:本文中的is_executable函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。