MacPorts Apache2 在启动时停止启动 [英] MacPorts Apache2 Stopped Launching on Boot

查看:32
本文介绍了MacPorts Apache2 在启动时停止启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在两台不同的机器上注意到的一点是,当我启动时,通过 MacPorts 安装的 Apache2 似乎停止了启动.诚实的事实是,我以前不能发誓它这样做了,但我想我会注意到这一点,因为安装 LaunchDaemon 是我安装过程的一部分.事实上,如果我尝试重新加载 LaunchDaemon,它会失败:

Something that I've noticed recently on two different machines is that Apache2 installed via MacPorts seems to have stopped launching when I boot up. The honest truth is that I can't swear it did so before, but it's something I think I'd notice because installing the LaunchDaemon is part of my install process. In fact, if I try to reload the LaunchDaemon, it fails:

$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
org.macports.apache2: Already loaded

除非我手动启动 Apache(使用 sudo apachectl restart),否则在我的进程列表中搜索apache2"或httpd"只会产生这个:

Unless I start Apache manually (using sudo apachectl restart), grep'ing for either "apache2" or "httpd" in my process list only produces this:

$ sudo ps -ef | egrep "apache2|httpd"
    0    52     1   0   0:00.06 ??         0:00.08 /opt/local/bin/daemondo --label=apache2 --start-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart ; --pid=none

1410639199 6960 6792 0 0:00.00 ttys001 0:00.00 egrep apache2|httpd

1410639199 6960 6792 0 0:00.00 ttys001 0:00.00 egrep apache2|httpd

看起来守护进程本身就位,但没有可执行文件.据我所知/可以告诉,相关的可执行文件(httpd 和 apachectl)是每个人都可以执行的.

Looks like the daemon itself is in place, but no executable. As far as I know/can tell, the relevant executables (httpd and apachectl) are executable by everyone.

有没有其他人注意到这一点?有什么想法吗?

Has anyone else noticed this? Any ideas?

更新

按照下面的要求,我确实执行了launchctl list.列表很长,我不知道如何剪断它,但可以说没有列出任何 org.macports.* 项目.这本身很有趣,因为我的 MySQL 守护程序以相同的方式加载.它有效,但也没有出现在列表中.让我知道是否真的需要整个输出.

As requested below, I did execute launchctl list. The list is long and I'm not sure how to snip it, but suffice to say that no org.macports.* items are listed. That in itself is interesting because my MySQL daemon is loaded the same way. It works, but also doesn't appear in the list. Let me know if the entire output is really needed.

更新

我假设我已经在 sudo 下执行了 launchctl list,但在下面 mipadi 的评论提示下,我再次尝试确保我这样做了,但我假设错误.在 sudo 下执行时,出现 MacPorts 项:

I assumed that I had executed launchctl list under sudo, but prompted by mipadi's comment below, I tried again ensuring that I did so and I assumed incorrectly. When executed under sudo, the MacPorts items appear:

51  -   org.macports.mysql5
52  -   org.macports.apache2

我不确定这是否会有所帮助,但还是提供了更多信息.

I'm not sure whether that will help, but it's a little more info nonetheless.

更新

我在 LaunchDaemons 和环境变量 中提出了一个不同但相关的问题.随着我了解更多信息,我会更新这两个问题.

I've asked a different, but related, question at LaunchDaemons and Environment Variables. I'll update both questions as I learn more.

更新

今天,根据邮件列表输入,我尝试使用通配符主目录.在学术上,它比我想要的更具包容性,但实际情况是我是唯一一个使用这台计算机的人;当然是唯一一个拥有 Apache 配置文件的人.

Today, based on mailing list input, I tried using a wildcard home directory. Academically, it's a little more inclusive than I'd like, but the practical reality is that I'm the only one using this computer; certainly the only one who'd have Apache config files laying around.

Include "/Users/*/Dropbox/Application Support/apache/conf.d.osx/*.conf"
Include "/Users/*/Library/Application Support/MacPorts/apache/conf.d/*.conf"

不幸的是...

httpd: Syntax error on line 512 of /opt/local/apache2/conf/httpd.conf: Wildcard patterns not allowed in Include /Users/*/Dropbox/Application Support/apache/conf.d.osx/*.conf

推荐答案

既然我现在知道 为什么 Apache 已在启动时停止加载,我将阐明该答案并将此问题标记为已回答.Apache 在启动时停止启动的原因是我正在尝试跨系统共享 httpd.conf 文件.配置文件需要从我的主目录中存在的目录中Include 文件.由于每台机器上的主目录不同,我试图引用 ${HOME} 环境变量.

Since I now know why Apache has stopped loading on startup, I'm going to articulate that answer and mark this question as answered. The reason Apache has stopped launching on boot is that I'm trying to share an httpd.conf file across systems. The config file needs to Include files from directories that exist within my home directory. Since the home directory is different on each machine, I was trying to reference the ${HOME} environment variable.

这在机器启动后手动启动时工作正常,但在启动时失败,因为尚未设置环境变量.如上所述,请参阅这个问题了解更多信息.

This works fine when manually starting after the machine is booted, but fails on startup because the environment variable isn't yet set. As mentioned above, see this question for more information.

这篇关于MacPorts Apache2 在启动时停止启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆