【问题标题】:how to set env variable for apache on Mac OS X如何在 Mac OS X 上为 apache 设置环境变量
【发布时间】:2012-03-15 19:38:39
【问题描述】:

我正在使用 Snow Leopard 和 Apache 2.2。我想在虚拟主机日志设置中设置APACHE_ERROR_LOG

不知何故,我的错误日志设置以usr/$ 为前缀。我猜它一定是在某个我现在无法弄清楚的环境中。

我在 apache 日志中得到错误:

[error] (2)No such file or directory: could not open transfer log file /usr/$PATH_SPECIFIED_FOR_VIRTUAL_HOST_LOGS

【问题讨论】:

  • 您或许可以使用这个问题的答案(关于 PATH 环境变量):stackoverflow.com/questions/6833939/…
  • 不,这并没有解决问题。我无法真正弄清楚 /usr/$ 是从哪里附加的问题。然后我尝试完全发出ErrorLog只是为了在没有日志设置的情况下继续前进我得到你没有权限访问/在此服务器上。 403 错误。这里有什么问题?以及日志有什么问题

标签: macos apache


【解决方案1】:

这就是问题所在。在其中一个虚拟主机中,我有错字,它以 # 开头。 http.conf 有 server-root 配置,上面写着

# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk.  If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/usr"

It was terrible typo mstake.

【讨论】:

    【解决方案2】:

    在 mac OS 中永久设置环境变量的最简单方法:

    打开终端应用:

    open -a /Applications/TextEdit.app ~/.bash_profile
    

    在最近打开的文本编辑窗口中,在文件底部添加给定的环境变量,例如:

    export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/"
    

    注意:确保使用:(") 而不是 (")

    【讨论】:

      猜你喜欢
      • 2011-10-10
      • 2017-07-08
      • 2013-11-27
      • 2011-11-22
      • 2014-05-15
      • 2015-11-28
      • 1970-01-01
      相关资源
      最近更新 更多