简体   繁体   English

CakePHP,设置“ cake”环境变量吗?

[英]CakePHP, Set “cake” Environment Variable?

I'm using the "cake" console in cakephp on Mac OS X 10.6.2. 我在Mac OS X 10.6.2上的cakephp中使用“ cake”控制台。 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? 如何设置环境变量(或PATH?),以便我需要在终端中键入的只是“ cake” ...而不是控制台应用程序的完整路径?

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. 在终端命令和这些UNIX方面,我无疑是一个新手(但是我正在学习!),所以如果我的解释/词汇有些偏离,请多多包涵。

You should add 您应该添加

alias cake=PATH_TO_CAKE

To your .bashrc file (it's usually in your home directory). 到您的.bashrc文件(通常在您的主目录中)。

To expose all cake scripts in the shell directory, add the cake shell path to your system path. 要显示shell目录中的所有cake脚本,请将cake shell路径添加到系统路径。

export PATH=/your_path_to_cake:$PATH

Both alias and export can be added to your .bashrc file or executed directly on the command line. 别名和导出都可以添加到您的.bashrc文件中,或直接在命令行上执行。 .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. .bashrc是一个Shell脚本,它将在您每次启动新的Shell会话时执行,并且放置一行或两行将使Cake指向正确的程序,而不管您的工作目录如何。

The above solution posted by matiasf should get you going pretty quickly. matiasf发布的上述解决方案应该可以使您快速入门。

The only thing I'd recommend is putting your cake directory in a central location (ie, /usr/local/cake). 我唯一推荐的就是将您的Cake目录放在中央位置(即/ 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. 我最近在博客文章( http://developinginthedark.com/posts/cakephp-tip-2-run-multiple-cakephp-releases )中写下了一些说明,并逐步介绍了如何在Mac上进行设置(用户评论了有关Windows),特别着重于启动和运行支持多个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. 希望这对您和/或其他人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM