如何在Mac OS X上为apache设置env变量

时间:2012-02-25 17:30:52

标签: macos apache

我正在使用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

2 个答案:

答案 0 :(得分:1)

这是错的。在其中一个虚拟主机中,我有拼写错误,它以#开头。 http.conf具有服务器根配置,表示

# 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.

答案 1 :(得分:0)

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

打开终端应用程序:

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

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

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

注意:请确保使用:(“)而不是(”)