本文整理汇总了PHP中is_executable函数的典型用法代码示例。如果您正苦于以下问题:PHP is_executable函数的具体用法?PHP is_executable怎么用?PHP is_executable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_executable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 <[email protected]>
* @author Manuel Bernhardt <[email protected]>
*/
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
示例16: checkWriteExcute
public static function checkWriteExcute($path)
{
if (is_executable($path) && is_writable($path)) {
return true;
}
return false;
}
开发者ID:binnguyen,项目名称:kaffabasic,代码行数:7,代码来源:setupUtility.php
示例17: find
/**
* Finds an executable by name.
*
* @param string $name The executable name (without the extension)
* @param string $default The default to return if no executable is found
* @param array $extraDirs Additional dirs to check into
*
* @return string The executable path or default value
*/
public function find($name, $default = null, array $extraDirs = array())
{
if (ini_get('open_basedir')) {
$searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
$dirs = array();
foreach ($searchPath as $path) {
// Silencing against https://bugs.php.net/69240
if (@is_dir($path)) {
$dirs[] = $path;
} else {
if (basename($path) == $name && @is_executable($path)) {
return $path;
}
}
}
} else {
$dirs = array_merge(explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')), $extraDirs);
}
$suffixes = array('');
if ('\\' === DIRECTORY_SEPARATOR) {
$pathExt = getenv('PATHEXT');
$suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes;
}
foreach ($suffixes as $suffix) {
foreach ($dirs as $dir) {
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $name . $suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
return $file;
}
}
}
return $default;
}
开发者ID:ayoah,项目名称:symfony,代码行数:41,代码来源:ExecutableFinder.php
示例18: __construct
public function __construct()
{
parent::__construct();
// check pwauth executable
$this->pwauth_path = $this->getConf('pwauth_path');
$this->passwd_path = $this->getConf('passwd_path');
$this->shells_path = $this->getConf('shells_path');
$this->email_domain_name = $this->getConf('email_domain_name');
if (is_executable($this->pwauth_path)) {
$this->cando['addUser'] = false;
$this->cando['delUser'] = false;
$this->cando['modLogin'] = false;
$this->cando['modPass'] = false;
$this->cando['modName'] = false;
$this->cando['modMail'] = false;
$this->cando['modGroups'] = false;
if (is_readable($this->passwd_path)) {
$this->cando['getUsers'] = true;
$this->cando['getUserCount'] = true;
} else {
$this->cando['getUsers'] = false;
$this->cando['getUserCount'] = false;
}
$this->cando['getGroups'] = false;
$this->cando['external'] = false;
$this->cando['logout'] = true;
$this->success = true;
} else {
$this->success = false;
echo "pwauth not found!";
}
}
开发者ID:jamilnavarro,项目名称:dokuwiki-authpwauth,代码行数:32,代码来源:auth.php
示例19: realpath
/**
* Returns the path to a specific executable
*
* @param string $command Name or path of the command
* @return mixed
*/
public static function realpath($command)
{
// check if everything we need is available
if (!static::available()) {
throw new Exception('The exec() function is not available on this system. Probably, safe_mode is on (shame!).');
}
// if this is actually a file, we don't need to search for it any longer
if (file_exists($command)) {
return is_executable($command) ? realpath($command) : false;
}
// let the shell search for it
// depends on the operating system
$exists = false;
// does the command exist?
$result = '';
// where is it located?
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
// Windows
// run the "where" command
$result = `where {$command}`;
// everything besides "Could not find files" would be OK
$exists = !preg_match('/Could not find files/', $result);
} else {
// Unix
// run the "which" command
$result = `which {$command}`;
// an empty output means there is no path
$exists = !empty($result);
}
return $exists ? trim($result) : false;
}
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:37,代码来源:system.php
示例20: __construct
protected function __construct() {
$idFile = wfTempDir() . '/mw-' . __CLASS__ . '-UID-nodeid';
$nodeId = is_file( $idFile ) ? file_get_contents( $idFile ) : '';
// Try to get some ID that uniquely identifies this machine (RFC 4122)...
if ( !preg_match( '/^[0-9a-f]{12}$/i', $nodeId ) ) {
wfSuppressWarnings();
if ( wfIsWindows() ) {
// http://technet.microsoft.com/en-us/library/bb490913.aspx
$csv = trim( wfShellExec( 'getmac /NH /FO CSV' ) );
$line = substr( $csv, 0, strcspn( $csv, "\n" ) );
$info = str_getcsv( $line );
$nodeId = isset( $info[0] ) ? str_replace( '-', '', $info[0] ) : '';
} elseif ( is_executable( '/sbin/ifconfig' ) ) { // Linux/BSD/Solaris/OS X
// See http://linux.die.net/man/8/ifconfig
$m = array();
preg_match( '/\s([0-9a-f]{2}(:[0-9a-f]{2}){5})\s/',
wfShellExec( '/sbin/ifconfig -a' ), $m );
$nodeId = isset( $m[1] ) ? str_replace( ':', '', $m[1] ) : '';
}
wfRestoreWarnings();
if ( !preg_match( '/^[0-9a-f]{12}$/i', $nodeId ) ) {
$nodeId = MWCryptRand::generateHex( 12, true );
$nodeId[1] = dechex( hexdec( $nodeId[1] ) | 0x1 ); // set multicast bit
}
file_put_contents( $idFile, $nodeId ); // cache
}
$this->nodeId32 = wfBaseConvert( substr( sha1( $nodeId ), 0, 8 ), 16, 2, 32 );
$this->nodeId48 = wfBaseConvert( $nodeId, 16, 2, 48 );
// If different processes run as different users, they may have different temp dirs.
// This is dealt with by initializing the clock sequence number and counters randomly.
$this->lockFile88 = wfTempDir() . '/mw-' . __CLASS__ . '-UID-88';
$this->lockFile128 = wfTempDir() . '/mw-' . __CLASS__ . '-UID-128';
}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:33,代码来源:UIDGenerator.php
注:本文中的is_executable函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论