CakePHP,设置“蛋糕”环境变量?
我在 Mac OS X 10.6.2 上使用 cakephp 中的“cake”控制台。如何设置环境变量(或路径?),以便我需要在终端中输入的是“cake”......而不是控制台应用程序的完整路径?
当谈到终端命令和这些 UNIX 的东西时,我毫不掩饰是一个新手(但我正在学习!),所以如果我的解释/词汇有点偏差,请耐心等待。
I'm using the "cake" console in cakephp on Mac OS X 10.6.2. How do I set up the environment variable (or PATH?) so that all I need to type in terminal is "cake"... as opposed to the full path to the console app?
I'm unabashedly a newb when it comes to terminal commands and these UNIX things (but I'm learning!), so bear with me if my explanation/vocabulary is a bit off.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该添加
到您的 .bashrc 文件(通常位于您的主目录中)。
要公开 shell 目录中的所有 cake 脚本,请将 cake shell 路径添加到系统路径。
别名和导出都可以添加到 .bashrc 文件中或直接在命令行上执行。 .bashrc 是一个 shell 脚本,每次启动新的 shell 会话时都会执行该脚本,并且无论您的工作目录如何,放置其中一行或两行都会使 cake 指向正确的程序。
You should add
To your .bashrc file (it's usually in your home directory).
To expose all cake scripts in the shell directory, add the cake shell path to your system path.
Both alias and export can be added to your .bashrc file or executed directly on the command line. .bashrc is a shell script which will be executed each time you start a new shell session and placing one or both of the lines will make cake point to the correct program reagardless of your working directory.
matiasf 发布的上述解决方案应该可以让您很快上手。
我唯一建议的是将蛋糕目录放在一个中心位置(即/usr/local/cake)。
我最近在博客文章中写了一些说明(http:// /developinginthedark.com/posts/cakephp-tip-2-run-multiple-cakephp-releases),逐步完成 Mac 上的设置(以及 Windows 的用户评论说明),特别侧重于建立环境并运行支持多个版本的 CakePHP。
听起来您只需要开始使用一个版本,但说明应该仍然相关。
希望这对您自己和/或其他人有所帮助。
The above solution posted by matiasf should get you going pretty quickly.
The only thing I'd recommend is putting your cake directory in a central location (ie, /usr/local/cake).
I recently wrote up some instructions in a blog post (http://developinginthedark.com/posts/cakephp-tip-2-run-multiple-cakephp-releases) that walks through settings things up on a Mac (and user commented instructions for Windows), specifically focusing on getting an environment up and running that supports multiple releases of CakePHP.
It sounds like you just need to get going with one version, but the instructions should still be relevant.
Hopefully this helps yourself and/or others.