如何添加路径到Apache PATH变量? [英] How do I add paths to the Apache PATH variable?

查看:165
本文介绍了如何添加路径到Apache PATH变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在custom.conf文件已经设置的Apache2这样的:

I've set in my custom.conf file in apache2 this:

SetEnv PATH $PATH:/opt/local/lib/mysql5/bin:/this-is-a-test

但它不工作。当我打电话:

However it's not working. When I call:

$hey = shell_exec('env'." 2>&1"); var_dump($hey);

我得到:

... PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/opt/local/bin

谁能帮助?我使用的MacPorts我的开发环境的Mac。
谢谢!

Can anyone help? I'm on Mac using Macports for my development environment. Thanks!

推荐答案

这看起来非常奇怪,我认为你正试图从内部的Apache设置PATH。相反,你应该设置为你的系统路径。有几种方法在Mac OS X要做到这一点:

That seems awfully strange to me that you are trying to set the PATH from within Apache. Instead, you should be setting the PATH for your system. There are several ways to do this in Mac OS X:

用户专用

对于单个用户,可以编辑〜/ .profile文件并添加:

User-specific
For a single user, you can edit ~/.profile and add:

export PATH="$PATH":/opt/local/lib/mysql5/bin:/this-is-a-test

或者你也可以创建/编辑〜/ .MacOSX / environment.plist并定义路径的方式。

Or you can create/edit ~/.MacOSX/environment.plist and define the PATH that way.

全系统

在Mac OS X的新版本,有一个名为在/ etc /路径,有一个名为/etc/paths.d,让您扩展默认路径文件夹文件。基本上,你将创建/etc/paths.d,列出所有你想要添加到默认的路径中的路径的文件。在Mac OS X版本不支持这个(你可以告诉依据的/ usr / libexec中/ path_helper是否存在),可以通过将出口上述声明在/ etc / profile文件为所有用户编辑的默认路径。

System-wide
On newer versions of Mac OS X, there is a file named "/etc/paths" and there is a folder named "/etc/paths.d" that allow you to extend the default paths. Basically, you would create a file in "/etc/paths.d" that lists all the paths that you wish to add to the default paths. On versions of Mac OS X that do not support this (you can tell based on whether "/usr/libexec/path_helper" exists), one can edit the default paths for all users by placing the export statement above in /etc/profile.

这篇关于如何添加路径到Apache PATH变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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