本文整理汇总了PHP中unix::LIGHTTPD_USER方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::LIGHTTPD_USER方法的具体用法?PHP unix::LIGHTTPD_USER怎么用?PHP unix::LIGHTTPD_USER使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::LIGHTTPD_USER方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sslbridgre
function sslbridgre(){
if(!is_file("/usr/share/artica-postfix/sslbridge/index.php")){return;}
$unix=new unix();
$ligghtpd=$unix->LIGHTTPD_USER();
shell_exec("/bin/chown -R $ligghtpd:$ligghtpd /usr/share/artica-postfix/sslbridge");
shell_exec("/bin/chmod -R 755 /usr/share/artica-postfix/sslbridge");
$f[]="<?php";
$f[]="define(\"LOCALHOST\", \"localhost\");";
$f[]="define(\"SYSTEMDIR\", '/tmp');";
$f[]="// define(\"DEBUG\", true);";
$f[]="?>";
@file_put_contents("/usr/share/artica-postfix/sslbridge/config.php",@implode("\n",$f));
}
示例2: CompressCategories
function CompressCategories()
{
$sock = new sockets();
$EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
if (!is_numeric($EnableRemoteStatisticsAppliance)) {
$EnableRemoteStatisticsAppliance = 0;
}
if ($EnableRemoteStatisticsAppliance == 1) {
return;
}
$unix = new unix();
$tar = $unix->find_program("tar");
$chmod = $unix->find_program("chmod");
$chown = $unix->find_program("chown");
$lighttpdUser = $unix->LIGHTTPD_USER();
$StorageDir = "/usr/share/artica-postfix/ressources/databases";
if (!is_dir("/var/lib/squidguard")) {
ufdbguard_admin_events("/var/lib/squidguard no such directory", __FUNCTION__, __FILE__, __LINE__, "global-compile");
return;
}
$t = time();
if (is_dir("/var/lib/squidguard")) {
chdir("/var/lib/squidguard");
if (is_file("{$StorageDir}/blacklist.tar.gz")) {
@unlink("{$StorageDir}/blacklist.tar.gz");
}
writelogs("Compressing /var/lib/squidguard", __FUNCTION__, __FILE__, __LINE__);
shell_exec("{$tar} -czf {$StorageDir}/blacklist.tar.gz *");
shell_exec("{$chmod} 770 {$StorageDir}/blacklist.tar.gz");
}
if (is_dir("/var/lib/ftpunivtlse1fr")) {
chdir("/var/lib/ftpunivtlse1fr");
writelogs("Compressing /var/lib/ftpunivtlse1fr", __FUNCTION__, __FILE__, __LINE__);
if (is_file("{$StorageDir}/ftpunivtlse1fr.tar.gz")) {
@unlink("{$StorageDir}/ftpunivtlse1fr.tar.gz");
}
shell_exec("{$tar} -czf {$StorageDir}/ftpunivtlse1fr.tar.gz *");
shell_exec("{$chmod} 770 {$StorageDir}/ftpunivtlse1fr.tar.gz");
}
if (is_dir("/etc/dansguardian")) {
chdir("/etc/dansguardian");
writelogs("Compressing /etc/dansguardian", __FUNCTION__, __FILE__, __LINE__);
if (is_file("{$StorageDir}/dansguardian.tar.gz")) {
@unlink("{$StorageDir}/dansguardian.tar.gz");
}
exec("{$tar} -czf {$StorageDir}/dansguardian.tar.gz * 2>&1", $lines);
while (list($linum, $line) = each($lines)) {
writelogs($line, __FUNCTION__, __FILE__, __LINE__);
}
if (!is_file("{$StorageDir}/dansguardian.tar.gz")) {
writelogs(".{$StorageDir}/dansguardian.tar.gz no such file", __FUNCTION__, __FILE__, __LINE__);
}
shell_exec("{$chmod} 770 /usr/share/artica-postfix/ressources/databases/dansguardian.tar.gz");
}
writelogs("Compressing done, apply permissions for `{$lighttpdUser}` user", __FUNCTION__, __FILE__, __LINE__);
shell_exec("{$chown} {$lighttpdUser}:{$lighttpdUser} {$StorageDir}");
shell_exec("{$chown} {$lighttpdUser}:{$lighttpdUser} {$StorageDir}/*");
$ttook = $unix->distanceOfTimeInWords($t, time(), true);
ufdbguard_admin_events("compress all categories done ({$ttook})", __FUNCTION__, __FILE__, __LINE__, "global-compile");
}
示例3: build
function build()
{
$unix = new unix();
@mkdir("/var/run/lighttpd", 0755, true);
@mkdir("/var/log/lighttpd", 0755, true);
$username = $unix->LIGHTTPD_USER();
$sock = new sockets();
$phpcgi = $unix->LIGHTTPD_PHP5_CGI_BIN_PATH();
$chown = $unix->find_program("chown");
$perlbin = $unix->find_program("perl");
$nohup = $unix->find_program("nohup");
$php = $unix->LOCATE_PHP5_BIN();
$PHP_STANDARD_MODE = true;
$SquidGuardApachePort = intval($sock->GET_INFO("SquidGuardApachePort"));
$SquidGuardApacheSSLPort = intval($sock->GET_INFO("SquidGuardApacheSSLPort"));
if ($SquidGuardApachePort == 0) {
$SquidGuardApachePort = 9020;
}
if ($SquidGuardApacheSSLPort == 0) {
$SquidGuardApacheSSLPort = 9025;
}
$SquidGuardWebSSLCertificate = $sock->GET_INFO("SquidGuardWebSSLCertificate");
@mkdir("/home/squid/error_page_sessions", 0755, true);
@mkdir("/home/squid/error_page_cache", 0755, true);
if ($username == null) {
$username = "www-data";
$unix->CreateUnixUser($username, $username, "lighttpd username");
}
if (preg_match("#^(.+?):(.+)#", $username, $re)) {
$username = $re[1];
$username = $re[1];
}
$SquidGuardStorageDir = $sock->GET_INFO("SquidGuardStorageDir");
@unlink("/var/log/lighttpd/squidguard-lighttpd-error.log");
@unlink("/var/log/lighttpd/squidguard-lighttpd.log");
if (!is_file("/var/log/lighttpd/squidguard-lighttpd.log")) {
@file_put_contents("/var/log/lighttpd/squidguard-lighttpd.log", "#");
}
if (!is_file("/var/log/lighttpd/squidguard-lighttpd-error.log")) {
@file_put_contents("/var/log/artica-postfix/lighttpd-error.log", "#");
}
$unix->chown_func($username, $username, "/var/log/lighttpd/squidguard-lighttpd.log");
$unix->chown_func($username, $username, "/var/log/lighttpd/squidguard-lighttpd-error.log");
$unix->chown_func($username, $username, "/home/squid/error_page_sessions");
$unix->chown_func($username, $username, "/home/squid/error_page_cache");
$unix->chown_func($username, $username, "/usr/share/artica-postfix/bin/install/squid/adzap/zaps/*");
@chmod("/var/log/lighttpd/squidguard-lighttpd-error.log", 0777);
@chmod("/var/log/lighttpd/squidguard-lighttpd.log", 0777);
if ($SquidGuardStorageDir == null) {
$SquidGuardStorageDir = "/home/artica/cache";
}
@mkdir($SquidGuardStorageDir, 0755, true);
$unix->chown_func($username, $username, $SquidGuardStorageDir);
$LighttpdUseUnixSocket = $sock->GET_INFO('LighttpdUseUnixSocket');
if (!is_numeric($LighttpdUseUnixSocket)) {
$LighttpdUseUnixSocket = 0;
}
$lighttpdPhpPort = $sock->GET_INFO('lighttpdPhpPort');
if (!is_numeric($lighttpdPhpPort)) {
$lighttpdPhpPort = 1808;
}
$LighttpdArticaMaxProcs = $sock->GET_INFO('LighttpdArticaMaxProcs');
if (!is_numeric($LighttpdArticaMaxProcs)) {
$LighttpdArticaMaxProcs = 0;
}
$LighttpdArticaMaxChildren = $sock->GET_INFO('LighttpdArticaMaxChildren');
if (!is_numeric($LighttpdArticaMaxChildren)) {
$LighttpdArticaMaxChildren = 0;
}
$LighttpdRunAsminimal = $sock->GET_INFO('LighttpdRunAsminimal');
if (!is_numeric($LighttpdRunAsminimal)) {
$LighttpdRunAsminimal = 0;
}
$PHP_FCGI_MAX_REQUESTS = $sock->GET_INFO('PHP_FCGI_MAX_REQUESTS');
if (!is_numeric($PHP_FCGI_MAX_REQUESTS)) {
$PHP_FCGI_MAX_REQUESTS = 200;
}
$EnablePHPFPM = $sock->GET_INFO('EnablePHPFPM');
if (!is_numeric($EnablePHPFPM)) {
$EnablePHPFPM = 0;
}
$EnableArticaApachePHPFPM = $sock->GET_INFO("EnableArticaApachePHPFPM");
if (!is_numeric($EnableArticaApachePHPFPM)) {
$EnableArticaApachePHPFPM = 0;
}
if ($EnableArticaApachePHPFPM == 0) {
$EnablePHPFPM = 0;
}
$PHP_STANDARD_MODE = true;
$phpcgi_path = $unix->LIGHTTPD_PHP5_CGI_BIN_PATH();
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Run as: {$username}\n";
}
$PHP_FCGI_CHILDREN = 1;
$max_procs = 2;
if ($LighttpdArticaMaxProcs > 0) {
$max_procs = $LighttpdArticaMaxProcs;
}
if ($LighttpdArticaMaxChildren > 0) {
$HP_FCGI_CHILDREN = $LighttpdArticaMaxChildren;
//.........这里部分代码省略.........
示例4: build
function build(){
CheckHttpdConf();
RemoveAllSites();
create_cron_task();
$sock=new sockets();
$unix=new unix();
$varWwwPerms=$sock->GET_INFO("varWwwPerms");
if($varWwwPerms==null){$varWwwPerms=755;}
remove_files();
$sql="SELECT * FROM freeweb ORDER BY servername";
$httpdconf=$unix->LOCATE_APACHE_CONF_PATH();
$apacheusername=$unix->APACHE_SRC_ACCOUNT();
$GLOBALS["apacheusername"]=$apacheusername;
$DAEMON_PATH=$unix->getmodpathfromconf($httpdconf);
$q=new mysql();
$results=$q->QUERY_SQL($sql,'artica_backup');
if(!$q->ok){if($GLOBALS["VERBOSE"]){echo $q->mysql_error."\n";return;}}
$d_path=$unix->APACHE_DIR_SITES_ENABLED();
$mods_enabled=$DAEMON_PATH."/mods-enabled";
echo "Starting......: Apache daemon path: $d_path\n";
echo "Starting......: Apache mods path..: $mods_enabled\n";
if(!is_dir($d_path)){@mkdir($d_path,666,true);}
if(!is_dir($mods_enabled)){@mkdir($mods_enabled,666,true);}
$count=mysql_num_rows($results);
echo "Starting......: Apache checking virtual web sites count:$count\n";
if($count==0){
$users=new usersMenus();
echo "Starting......: Apache building default $users->hostname...\n";
buildHost($unix->LIGHTTPD_USER(),$users->hostname,0,$d_path);
}
while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){
$uid=$ligne["uid"];
$hostname=$ligne["servername"];
$ssl=$ligne["useSSL"];
echo "Starting......: Apache \"$hostname\" starting
\n";
buildHost($uid,$hostname,$ssl,$d_path);
}
$users=$GLOBALS["CLASS_USERS_MENUS"];
$APACHE_MOD_AUTHNZ_LDAP=$users->APACHE_MOD_AUTHNZ_LDAP;
if(is_file($GLOBALS["a2enmod"])){
if($APACHE_MOD_AUTHNZ_LDAP){
if($GLOBALS["VERBOSE"]){echo "Starting......: Apache {$GLOBALS["a2enmod"]} authnz_ldap\n";}
shell_exec("{$GLOBALS["a2enmod"]} authnz_ldap >/dev/null 2>&1");
}
}
$sock=$GLOBALS["CLASS_SOCKETS"];
if($sock->GET_INFO("ArticaMetaEnabled")==1){
sys_THREAD_COMMAND_SET(LOCATE_PHP5_BIN()." ".dirname(__FILE__)."/exec.artica.meta.users.php --export-freewebs");
}
}
示例5: build
function build()
{
$unix = new unix();
if (is_file("/etc/artica-postfix/FROM_ISO")) {
if ($unix->file_time_min("/etc/artica-postfix/FROM_ISO") < 1) {
return;
}
}
$mef = basename(__FILE__);
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid, $mef)) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache building : Process Already exist pid {$pid} line:" . __LINE__ . "\n";
return;
}
@file_put_contents($pidfile, getmypid());
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> CheckHttpdConf();\n";
}
CheckHttpdConf();
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> RemoveAllSites();\n";
}
RemoveAllSites();
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> create_cron_task();\n";
}
create_cron_task();
sync_squid();
$sock = new sockets();
$FreeWebDisableSSL = intval(trim($sock->GET_INFO("FreeWebDisableSSL")));
$php5 = $unix->LOCATE_PHP5_BIN();
$varWwwPerms = $sock->GET_INFO("varWwwPerms");
if ($varWwwPerms == null) {
$varWwwPerms = 755;
}
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> remove_files();\n";
}
remove_files();
$sql = "SELECT * FROM freeweb ORDER BY servername";
$httpdconf = $unix->LOCATE_APACHE_CONF_PATH();
$apacheusername = $unix->APACHE_SRC_ACCOUNT();
$GLOBALS["apacheusername"] = $apacheusername;
$DAEMON_PATH = $unix->getmodpathfromconf($httpdconf);
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> sql();\n";
}
$q = new mysql();
$results = $q->QUERY_SQL($sql, 'artica_backup');
if (!$q->ok) {
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache {$q->mysql_error}\n";
return;
}
}
$d_path = $unix->APACHE_DIR_SITES_ENABLED();
$mods_enabled = $DAEMON_PATH . "/mods-enabled";
if ($FreeWebDisableSSL == 0) {
SSL_DEFAULT_VIRTUAL_HOST();
}
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache daemon path: {$d_path}\n";
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache mods path..: {$mods_enabled}\n";
if (!is_dir($d_path)) {
@mkdir($d_path, 666, true);
}
if (!is_dir($mods_enabled)) {
@mkdir($mods_enabled, 666, true);
}
$count = mysql_num_rows($results);
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache checking virtual web sites count:{$count}\n";
if ($count == 0) {
$users = new usersMenus();
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache building default {$users->hostname}...\n";
buildHost($unix->LIGHTTPD_USER(), $users->hostname, 0, $d_path);
}
if ($GLOBALS["VERBOSE"]) {
$add_plus = " --verbose";
}
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
$uid = $ligne["uid"];
$hostname = $ligne["servername"];
$ssl = $ligne["useSSL"];
if ($FreeWebDisableSSL == 1) {
$ssl = 0;
}
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache \"{$hostname}\" starting\n";
$cmd = "{$php5} " . __FILE__ . " --sitename \"{$hostname}\" --no-httpd-conf --noreload{$add_plus}";
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache \"{$cmd}\"\n";
}
shell_exec($cmd);
}
$users = $GLOBALS["CLASS_USERS_MENUS"];
$APACHE_MOD_AUTHNZ_LDAP = $users->APACHE_MOD_AUTHNZ_LDAP;
if (is_file($GLOBALS["a2enmod"])) {
if ($APACHE_MOD_AUTHNZ_LDAP) {
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache {$GLOBALS["a2enmod"]} authnz_ldap\n";
}
//.........这里部分代码省略.........