本文整理汇总了PHP中unix::LOCATE_APACHE_CTL方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::LOCATE_APACHE_CTL方法的具体用法?PHP unix::LOCATE_APACHE_CTL怎么用?PHP unix::LOCATE_APACHE_CTL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::LOCATE_APACHE_CTL方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vhosts
//.........这里部分代码省略.........
$adds = $adds . "\tAddDefaultCharset ISO-8859-15\n";
$adds = $adds . "\tAccessFileName .htaccess\n";
$rewrite[] = "\t\t\t<IfModule mod_rewrite.c>";
$rewrite[] = "\t\t\t\tRewriteEngine on";
$rewrite[] = "\t\t\t\tRewriteBase /";
$rewrite[] = "\t\t\t\tRewriteCond %{REQUEST_FILENAME} !-f";
$rewrite[] = "\t\t\t\tRewriteCond %{REQUEST_FILENAME} !-d";
$rewrite[] = "\t\t\t\tRewriteRule ^(.*)\$ index.php?q=\$1 [L,QSA]";
$rewrite[] = "\t\t\t</IfModule>";
$rewrite[] = "\t\t\t<FilesMatch \"\\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\\.php)?|xtmpl)\$|^(code-style\\.pl|Entries.*|Repository|Root|Tag|Template)\$\">";
$rewrite[] = "\t\t\t\tOrder allow,deny";
$rewrite[] = "\t\t\t\tdeny from all";
$rewrite[] = "\t\t\t</FilesMatch>";
$dirplus[] = "\t\t\t<Location /cron.php>";
$dirplus[] = "\t\t\t\tOrder deny,allow";
$dirplus[] = "\t\t\t\tdeny from all";
$dirplus[] = "\t\t\t\tallow from 127.0.0.1";
$dirplus[] = "\t\t\t\tallow from IP";
$dirplus[] = "\t\t\t</Location>";
$root = "/usr/share/drupal";
@mkdir("/usr/share/drupal/sites/{$apacheservername}/files", 0755, true);
@chmod("/usr/share/drupal/sites/{$apacheservername}/files", 0777);
}
if ($wwwservertype == "SQUID_STATS") {
$DirectoryIndex = "squid.logon.php";
$open_basedir = "/usr/share/artica-postfix/ressources:/usr/share/artica-postfix:/usr/share/artica-postfix/framework:{$root}:{$root}/resources:{$root}/ressources/logs";
}
if ($wwwservertype == "GROUPOFFICE") {
$open_basedir = null;
}
if ($wwwservertype == "ARTICA_USR") {
$open_basedir = "/usr/share/artica-postfix/ressources:/usr/share/artica-postfix:/usr/share/artica-postfix/framework:{$root}:{$root}/resources:{$root}/ressources/logs";
}
if ($GLOBALS["VERBOSE"]) {
echo " *** OPENBASE DIR: {$wwwservertype} *** \n";
}
if ($GLOBALS["VERBOSE"]) {
echo " *** OPENBASE DIR: {$open_basedir} *** \n";
}
@mkdir("{$root}/php_logs/{$apacheservername}", 0755, true);
$conf = $conf . "\n\n<VirtualHost {$ApacheGroupwareListenIP}:{$ApacheGroupWarePort_WRITE}>\n";
$conf = $conf . "\tServerName {$apacheservername}\n";
$conf = $conf . "\tServerAdmin webmaster@{$apacheservername}\n";
$conf = $conf . "\tDocumentRoot {$root}\n";
$conf = $conf . $ssl;
$conf = $conf . $alias;
$conf = $conf . $adds;
$conf = $conf . "\tphp_value error_log \"{$root}/php_logs/{$apacheservername}/php.log\"\n";
if ($open_basedir == null) {
$conf = $conf . "\tphp_value open_basedir \"{$root}\"\n";
}
$conf = $conf . "\tphp_value magic_quotes_gpc {$magic_quotes_gpc}\n";
$conf = $conf . "\t<Directory \"{$root}\">\n";
if (is_array($rewrite)) {
$conf = $conf . @implode("\n", $rewrite) . "\n";
}
$conf = $conf . "\t\t\tDirectoryIndex {$DirectoryIndex}\n";
$conf = $conf . "\t\t\tOptions Indexes FollowSymLinks MultiViews\n";
$conf = $conf . "\t\t\tAllowOverride all\n";
$conf = $conf . "\t\t\tOrder allow,deny\n";
$conf = $conf . "\t\t\tAllow from all\n";
$conf = $conf . "\t</Directory>\n";
if (is_array($dirplus)) {
$conf = $conf . @implode("\n", $dirplus) . "\n";
}
$conf = $conf . "\tCustomLog /usr/local/apache-groupware/logs/{$apacheservername}_access.log \"%h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\" %V\"\n";
$conf = $conf . "\tErrorLog /usr/local/apache-groupware/logs/{$apacheservername}_err.log\n";
$conf = $conf . "</VirtualHost>\n";
if ($ApacheGroupware == 0) {
$a2ensite = $unix->find_program("a2ensite");
@mkdir($d_path, 0755, true);
echo "Starting......: " . date("H:i:s") . " Apache Groupware adding {$d_path}/groupware-artica-{$apacheservername}.conf\n";
@file_put_contents("{$d_path}/groupware-artica-{$apacheservername}.conf", $conf);
if (is_file($a2ensite)) {
shell_exec("{$a2ensite} {$d_path}/groupware-artica-{$apacheservername}.conf");
}
$conf = null;
}
}
if ($SSLMODE) {
if ($SSLStrictSNIVHostCheck == 1) {
$SSLStrictSNIVHostCheck = "\nSSLStrictSNIVHostCheck off";
}
$conf = "Listen {$ApacheGroupWarePortSSL}{$SSLStrictSNIVHostCheck}\nNameVirtualHost *:{$ApacheGroupWarePortSSL}\n" . $conf;
}
$mailmanhosts = mailmanhosts();
if ($ApacheGroupware == 0) {
echo "Starting......: " . date("H:i:s") . " Apache Groupware adding {$d_path}/groupware-artica-mailmanhosts.conf\n";
@file_put_contents("{$d_path}/groupware-artica-mailmanhosts.conf", $mailmanhosts);
$apache2ctl = $unix->LOCATE_APACHE_CTL();
if (is_file($apache2ctl)) {
shell_exec("{$apache2ctl} -k restart");
}
}
$conf = $conf . $mailmanhosts;
if ($noecho) {
return $conf;
}
echo $conf;
}
示例2: stop
function stop($aspid = false)
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
if (!$aspid) {
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Already task running PID {$pid} since {$time}mn\n";
}
return;
}
}
@file_put_contents($pidfile, getmypid());
$pid = PID_NUM();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} already stopped...\n";
}
return;
}
$apache2ctl = $unix->LOCATE_APACHE_CTL();
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} with a ttl of {$time}mn\n";
}
$kill = $unix->find_program("kill");
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} killing smoothly PID {$pid} ( {$apache2ctl} )...\n";
}
$results = array();
exec("{$apache2ctl} -f /etc/zarafa/httpd.conf -k stop 2>&1", $results);
while (list($index, $dir) = each($results)) {
if (preg_match("#[0-9]+.*?not running#", $dir)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} killing \"forced\" PID {$pid}...\n";
}
unix_system_kill($pid);
break;
}
}
sleep(1);
for ($i = 1; $i < 10; $i++) {
$pid = PID_NUM();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Successfully stopped ...\n";
}
break;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} wait pid {$pid} {$i}/60\n";
}
shell_exec("{$apache2ctl} -f /etc/zarafa/httpd.conf -k kill >/dev/null 2>&1");
sleep(1);
}
$pid = PID_NUM();
if ($unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} killing \"forced\" PID {$pid}...\n";
}
unix_system_kill($pid);
sleep(1);
for ($i = 1; $i < 10; $i++) {
$pid = PID_NUM();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Successfully stopped ...\n";
}
break;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} wait {$i}/60\n";
}
sleep(1);
}
}
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} daemon success...\n";
}
return;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} daemon failed...\n";
}
}
示例3: stop
function stop($aspid = false)
{
$unix = new unix();
if (!$aspid) {
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service Already Artica task running PID {$pid} since {$time}mn\n";
}
return;
}
@file_put_contents($pidfile, getmypid());
}
$pid = PID_NUM();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service already stopped...\n";
}
return;
}
$pid = PID_NUM();
$nohup = $unix->find_program("nohup");
$php5 = $unix->LOCATE_PHP5_BIN();
$apache2ctl = $unix->LOCATE_APACHE_CTL();
shell_exec("{$apache2ctl} -f {$GLOBALS["APACHE_CONFIG_PATH"]} -k stop");
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service Shutdown pid {$pid}...\n";
}
unix_system_kill($pid);
for ($i = 0; $i < 5; $i++) {
$pid = PID_NUM();
if (!$unix->process_exists($pid)) {
break;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service waiting pid:{$pid} {$i}/5...\n";
}
sleep(1);
}
$pid = PID_NUM();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service success...\n";
}
return;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service shutdown - force - pid {$pid}...\n";
}
unix_system_kill_force($pid);
for ($i = 0; $i < 5; $i++) {
$pid = PID_NUM();
if (!$unix->process_exists($pid)) {
break;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service waiting pid:{$pid} {$i}/5...\n";
}
sleep(1);
}
if ($unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service failed...\n";
}
return;
}
}
示例4: apache_pid
function apache_pid()
{
$unix = new unix();
$pid = $unix->get_pid_from_file('/var/run/artica-apache/hotspot-apache.pid');
if ($unix->process_exists($pid)) {
return $pid;
}
$apache2ctl = $unix->LOCATE_APACHE_CTL();
return $unix->PIDOF_PATTERN($apache2ctl . " -f /etc/artica-postfix/hotspot-httpd.conf");
}
示例5: apache_start
function apache_start()
{
$unix = new unix();
$GLOBALS["SERVICE_NAME"] = "Artica Apache service";
$apachebin = $unix->LOCATE_APACHE_BIN_PATH();
$pid = apache_pid();
if ($unix->process_exists($pid)) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} already started {$pid} since {$timepid}Mn...\n";
}
return;
}
$nohup = $unix->find_program("nohup");
$php5 = $unix->LOCATE_PHP5_BIN();
$rm = $unix->find_program("rm");
$apache2ctl = $unix->LOCATE_APACHE_CTL();
apache_config();
$cmd = "{$nohup} {$php5} /usr/share/artica-postfix/exec.web-community-filter.php --register-lic >/dev/null 2>&1 &";
if ($GLOBALS["VERBOSE"]) {
echo "{$cmd}\n";
}
shell_exec($cmd);
$cmd = "{$apache2ctl} -f /etc/artica-postfix/httpd.conf -k start";
shell_exec($cmd);
for ($i = 0; $i < 6; $i++) {
$pid = apache_pid();
if ($unix->process_exists($pid)) {
break;
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} waiting {$i}/6...\n";
}
sleep(1);
}
$pid = apache_pid();
if ($unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Success service started pid:{$pid}...\n";
}
shell_exec("{$php5} /usr/share/artica-postfix/exec.apc.compile.php");
if (!is_file('/etc/init.d/artica-memcache')) {
shell_exec("{$php5} /usr/share/artica-postfix/exec.initslapd.php --memcache");
}
shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.shm.php --SessionMem >/dev/null 2>&1 &");
shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.shm.php --service-up >/dev/null 2>&1 &");
shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.initslapd.php --phppfm-restart-back >/dev/null 2>&1 &");
shell_exec("{$nohup} /etc/init.d/artica-memcached start >/dev/null 2>&1 &");
shell_exec("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
} else {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} failed...\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$cmd}\n";
}
apache_troubleshoot();
}
$APACHE_SRC_ACCOUNT = $unix->APACHE_SRC_ACCOUNT();
$APACHE_SRC_GROUP = $unix->APACHE_SRC_GROUP();
$unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, "/var/lib/php5/*");
}
示例6: LIGHTTPD_PID
function LIGHTTPD_PID()
{
$unix = new unix();
$pid = $unix->get_pid_from_file('/var/run/roundcube-apache/apache.pid');
if ($unix->process_exists($pid)) {
return $pid;
}
$apache2ctl = $unix->LOCATE_APACHE_CTL();
return $unix->PIDOF_PATTERN($apache2ctl . " -f.*?apache-roundcube.conf");
}
示例7: install
function install()
{
$GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/phpmyadmin.progress";
$GLOBALS["DOWNLOAD_PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/phpmyadmin.download.progress";
$uri = "http://articatech.net/download/phpMyAdmin-4.2.12.tar.gz";
//$uri="http://artica.fr/download/phpMyAdmin-4.2.12.tar.gz";
echo "Starting {$uri}\n";
$unix = new unix();
echo "Downloading phpMyAdmin-4.2.12.tar.gz...\n";
build_progress("{downloading} phpMyAdmin-4.2.12.tar.gz...", 20);
$TMP_FILE = $unix->TEMP_DIR() . "/phpMyAdmin-4.2.12.tar.gz";
$curl = new ccurl($uri);
$curl->Timeout = 2400;
$curl->WriteProgress = true;
$curl->ProgressFunction = "download_progress";
if (!$curl->GetFile($TMP_FILE)) {
@unlink($TMP_FILE);
build_progress("{downloading} phpMyAdmin-4.2.12.tar.gz {failed}...", 110);
return;
}
$tar = $unix->find_program("tar");
$rm = $unix->find_program("rm");
$nohup = $unix->find_program("nohup");
$php = $unix->LOCATE_PHP5_BIN();
$ln = $unix->find_program("ln");
build_progress("{extracting} phpMyAdmin-4.2.12.tar.gz...", 50);
$ERROR = false;
echo "{$tar} xvf {$TMP_FILE} -C /usr/share/ 2>&1\n";
exec("{$tar} xvf {$TMP_FILE} -C /usr/share/ 2>&1", $EXT);
while (list($index, $ligne) = each($EXT)) {
echo "{$ligne}\n";
if (preg_match("#(Cannot|recoverable|Error|exiting)\\s+#", $ligne)) {
echo "Error Found {$ligne}\n";
$ERROR = true;
}
}
if ($ERROR) {
build_progress("{extraction_failed}...", 110);
sleep(4);
if (is_file($TMP_FILE)) {
@unlink($TMP_FILE);
}
return;
}
if (is_file($TMP_FILE)) {
@unlink($TMP_FILE);
}
if (!is_dir("/usr/share/phpMyAdmin-4.2.12-all-languages")) {
build_progress("Destination failed...", 110);
return;
}
build_progress("Creating symbolic link", 50);
if (!is_link("/usr/share/phpmyadmin")) {
@unlink("/usr/share/phpmyadmin");
}
if (is_dir("/usr/share/phpmyadmin")) {
shell_exec("{$rm} -rf /usr/share/phpmyadmin");
}
shell_exec("{$ln} -sf /usr/share/phpMyAdmin-4.2.12-all-languages /usr/share/phpmyadmin");
build_progress("{restart_services}: Artica Status...", 50);
$php = $unix->LOCATE_PHP5_BIN();
build_progress("{restart_services}: Artica Web interface...", 80);
system("{$php} /usr/share/artica-postfix/exec.phpmyadmin.php --build");
system("{$php} /usr/share/artica-postfix/exec.lighttpd.php --apache-build");
$apache2ctl = $unix->LOCATE_APACHE_CTL();
system("{$apache2ctl} -f /etc/artica-postfix/httpd.conf -k restart");
build_progress("{success}...", 100);
}