如何添加路径到Apache PATH变量?

编程入门 行业动态 更新时间:2024-10-26 10:30:36
本文介绍了如何添加路径到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变量?

本文发布于:2023-05-31 10:03:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/389526.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变量   路径   Apache   PATH

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!