function test_mail_sender($to = "*****@*****.**")
{
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    if (function_exists('posix_getuid')) {
        $uid = posix_getuid();
    } else {
        $uid = '??';
    }
    if (function_exists('posix_geteuid')) {
        $euid = posix_geteuid();
    } else {
        $euid = '??';
    }
    if (function_exists('posix_getpwuid')) {
        $real_user = posix_getpwuid($uid);
        $effective_user = posix_getpwuid($euid);
    } else {
        $real_user = $uid;
        $effective_user = $euid;
    }
    if (function_exists('posix_getcwd')) {
        $cwd = posix_getcwd();
    } else {
        $cwd = getcwd();
    }
    $subject = sprintf("[Default mail sender] First mail from %s", $_SERVER['SERVER_NAME']);
    $message = sprintf("SAPI: %s\nreal user: %s\neffective user: %s\ncurrent dir: %s\nPHP version: %s", var_export(php_sapi_name(), true), var_export($real_user, true), var_export($effective_user, true), var_export($cwd, true), var_export(phpversion(), true));
    $headers = sprintf("X-Mailer: PHP/%s", phpversion());
    $mail = mail($to, $subject, $message, $headers);
    printf("mail() returned: %s", var_export($mail, true));
}
Example #2
0
 /**
  * Options:
  *   document_root:     Path to the document root.
  *   server_root:       Path to the directory to be used as the server root.
  *   error_log:
  *   access_log:
  *   httpd_conf:        Path to the httpd.conf file that will be generated.
  *   logger:            PSR3 Logger.
  *   executable:        Full path to the httpd or apache2 executable.
  *   port:              Port for apache to listen on.
  *   log_level:         Apache log level.
  *   template:          Filename of the template to be used for rendering the httpd.conf.
  *   modules:           Array of module files, keyed by module name, e.g.  php5_module => libphp5.so.
  *   module_finder:     ModuleFinder service.
  *   module_paths:      Additional paths for use by the module_finder service.
  */
 public function __construct()
 {
     // Default values.
     $this['cwd'] = $this->share(function ($container) {
         return posix_getcwd();
     });
     $this['home'] = $this->share(function ($container) {
         return getenv('HOME');
     });
     // Parameters
     $this['document_root'] = '%cwd%';
     $this['server_root'] = '%cwd%/.feather';
     $this['error_log'] = '%server_root%/error_log';
     $this['access_log'] = '%server_root%/access_log';
     $this['httpd_conf'] = '%server_root%/httpd.conf';
     $this['port'] = 8080;
     $this['log_level'] = 'info';
     $this['template'] = 'default.conf';
     $this['modules'] = array("authz_host_module" => "mod_authz_host.so", "dir_module" => "mod_dir.so", "env_module" => "mod_env.so", "mime_module" => "mod_mime.so", "log_config_module" => "mod_log_config.so", "rewrite_module" => "mod_rewrite.so", "php5_module" => "libphp5.so");
     $this['module_paths'] = array();
     $this['executable'] = $this->share(function ($container) {
         $finder = $container['executable_finder'];
         $names = array('httpd', 'apache2');
         if (!($executable = $finder->find($names))) {
             throw new \RuntimeException(sprintf('Unable to locate an executable named %s', join(', ', $names)));
         }
         return $executable;
     });
     // Services
     $this['logger'] = $this->share(function ($container) {
         return new NullLogger();
     });
     $this['executable_finder'] = $this->share(function ($container) {
         return new MultiExecutableFinder();
     });
     $this['module_finder'] = $this->share(function ($container) {
         $finder = new ModuleFinder();
         $finder->addPaths($container['module_paths']);
         return $finder;
     });
 }
Example #3
0
 static function getCurrentWorkingDirectory()
 {
     return posix_getcwd();
 }
Example #4
0
{
    var_dump($x === $y);
    if ($x !== $y) {
        echo "Failed: {$y}\n";
        echo "Got: {$x}\n";
        var_dump(debug_backtrace());
    }
}
function VERIFY($x)
{
    VS($x != false, true);
}
//////////////////////////////////////////////////////////////////////
VERIFY(posix_access(__DIR__ . "/ext_posix.php"));
VERIFY(strlen(posix_ctermid()));
VERIFY(strlen(posix_getcwd()));
$ret = posix_getgrgid(posix_getgid());
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
$bynam = posix_getgrnam($ret['name']);
VS($ret, $bynam);
$ret = posix_getgrnam("root");
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
$bygid = posix_getgrgid($ret['gid']);
VS($ret, $bygid);
// $ret = posix_getgroups();
// VERIFY($ret != false);
// VERIFY(count((array)$ret) != 0);
VERIFY(posix_getpgid(0));
VERIFY(posix_getpgrp());
Example #5
0
function core_phpinfo($id = '', $forced = False)
{
    global $core_tableDbg, $core_debug, $HTTP_POST_VARS;
    ksort($_GET);
    $core_dbgSV3 = $core_debug;
    if ($forced) {
        $core_debug = True;
    }
    if (!$core_debug) {
        return;
    }
    if ($id) {
        core_dbg('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', $id);
    }
    core_tdbg('version', $GLOBALS["version"], '');
    core_tdbg('CWD', 'PWD', posix_getcwd());
    core_phpinfoA($_POST, '_POST');
    core_phpinfoA($_GET, '_GET');
    core_phpinfoA($_FILES, '_FILES');
    core_phpinfoA($_SESSION, '_SESSION');
    //core_phpinfoA($_SESSION["request"],'_SESSION[request]');
    //core_phpinfoA($_SESSION["cnf "],'_SESSION[cnf]');
    //core_phpinfoA($_SESSION["_GET"],'_SESSION[_GET]');
    core_phpinfoA($GLOBALS["auth"], 'GLOBALS[auth]');
    core_phpinfoA($_ENV, '_ENV');
    foreach (array('DOCUMENT_ROOT', 'REMOTE_ADDR', 'REMOTE_USER', 'HTTP_REFERRER', 'SCRIPT_FILENAME', 'SCRIPT_URL', 'PHP_SELF', 'REQUEST_URI', 'QUERY_STRING') as $k) {
        core_tdbg("_SERVER", $k, $_SERVER[$k]);
    }
    if ($id) {
        core_dbg('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<', $id);
    }
    if ($core_tableDbg) {
        $core_tableDbg->close('</div>');
    }
    $core_tableDbg = False;
    $core_debug = $core_dbgSV3;
}
Example #6
0
<?php

var_dump(posix_getcwd());
var_dump(posix_getcwd(1));
Example #7
0
print_r($uname);
$times = posix_times();
foreach ($times as $k => $v) {
    if ($v < 0) {
        echo "times[{$k}] is negative\n";
    } else {
        echo "times[{$k}] is greater than or equal to 0\n";
    }
}
$ctermid = posix_ctermid();
echo "ctermid={$ctermid}\n";
$ttyname = posix_ttyname(1);
echo "ttyname for fd 1 = {$ttyname}\n";
$isatty = posix_isatty(1);
echo "isatty for fd 1 = {$isatty}\n";
$cwd = posix_getcwd();
if (file_exists($cwd)) {
    echo "posix_getcwd succeeded\n";
} else {
    echo "posix_getcwd failed\n";
}
// make sure the file we use for testing ain't there already
$testfile = "/tmp/phpoo_test_fifo204982";
if (file_exists($testfile)) {
    unlink($testfile);
}
$mkfifo = posix_mkfifo($testfile, 0);
echo "mkfifo={$mkfifo}\n";
// clean up test file without assuming we actually succeeded in creating it
if (file_exists($testfile)) {
    unlink($testfile);
Example #8
0
 /**
  * Pathname of current directory
  *
  * @return string
  */
 public function getcwd() : string
 {
     return posix_getcwd();
 }
Example #9
0
 /**
  * Get pathname of current directory
  *
  * @return string
  */
 public function getcwd()
 {
     return posix_getcwd();
 }
Example #10
0
right now the default script root directory is /, it needs to be the 
directory the script lives in for relative includes to work.
<BR>
This script needs to be run through mod_phpoo to matter.
<BR>
<?php 
print "current working directory is: " . posix_getcwd() . "\n";
Example #11
0
<?php

$loader = (require __DIR__ . '/../vendor/autoload.php');
$loader->add('MyCommands', __DIR__);
$dir = posix_getcwd();
while ($dir != '/') {
    if (file_exists($dir . '/composer.json')) {
        break;
    }
    $dir = dirname($dir);
}
$dir = '/' == $dir ? null : $dir;
$app = new \Milex\Application('Milex', '0.1', array('dir_current' => posix_getcwd(), 'dir_project' => $dir, 'dir_milex' => __DIR__, 'dir_user_home' => $_SERVER['HOME']));
$app['config'] = function () {
    return \Symfony\Component\Yaml\Yaml::parse(file_exists(__DIR__ . '/config.yml') ? __DIR__ . '/config.yml' : __DIR__ . '/config.yml.dist');
};
//var_dump(array_merge_recursive(
//    \Symfony\Component\Yaml\Yaml::parse(__DIR__ . '/config.yml.dist'),
//    \Symfony\Component\Yaml\Yaml::parse(__DIR__ . '/config.yml')
//));
$app->command(new \Milex\Command\ConfigVHostCommand());
$app->command(new \Milex\Command\Deploy());
if (is_dir($dir = __DIR__ . '/MyCommands')) {
    $finder = new \Symfony\Component\Finder\Finder();
    $finder->files()->name('*.php')->in($dir);
    foreach ($finder as $file) {
        $ns = '\\MyCommands';
        if ($relativePath = $file->getRelativePath()) {
            $ns .= '\\' . strtr($relativePath, '/', '\\');
        }
        $r = new \ReflectionClass($ns . '\\' . $file->getBasename('.php'));