OSX PHP 开发环境的最佳设置:MAMP +日食 +子剪辑 + X调试?其他?
在使用 Windows 多年后,我正在转向在 Mac 上进行开发(哇哦,新的 Macbook Air)。我之前的 PHP 开发设置是:
- WAMP
- NotePad++
- XDebug
- TortoiseSVN 和 WinMerge(链接到 Unfuddle svn 帐户)
我刚刚安装了 MAMP Pro(Pro 的评估副本)、适用于 PHP 开发人员的 Eclipse(版本:Helios Service Release 2,构建 ID: 20110218-0911) 和 Subclipse。我正在尝试在切换开发工具的同时克服“Mac 新手”的难题。这让我对我的设置的质疑比平时多了一千一百亿倍。我读过很多 StackOverflow 问题和答案,用谷歌搜索了很多开发环境教程。 我真正想问的是“请告诉我该怎么做才能在我漂亮的新 Mac 上获得良好的开发设置!”但由于这可能不是一个格式很好的问题,我会尝试缩小范围。(但如果你厌倦了阅读这个问题,只是想给我推荐一本好书或教程,请感觉免费!)
MAMP:好的,我想我对此没问题,对吧?如果我不想自己将 Mac 上预装的所有内容拼凑在一起,那么这几乎是事实上的标准。我可能愿意花 60 美元购买 MAMP Pro,因为我认识的开发人员告诉我,长期的便利是值得的。
IDE:我使用 Eclipse 已经好几年了……但用于 Windows 环境中的 Java 开发。在 Notepad++ 中使用 PHP 几年后,我很高兴能回到完整的 IDE。但我需要 Eclipse for PHP 吗? EclipsePDT?还有别的事吗?我根据几个 StackOverflow 答案选择了这个版本,这些答案提到 EclipsePDT 不一定能在 Mac 上很好地运行。
SVN:我采纳了 StackOverflow hive 的建议,为 eclipse 集成 SVN 插件安装 Sublipse。是的,看起来它正在工作,或者至少我可以浏览我的存储库。
调试:Zend Debug 附带 MAMP,对吧?我从未使用过它,但我对我的 Windows 机器上的 XDebug + Notepad++ 只是半满意,因为它一直锁定并需要每天多次重新启动 Notepad++。我会更爱 Zend 吗?我应该坚持使用 XDebug 吗? (或者,等等,Zend 只能与 Eclipse PDT 一起使用吗?)
现在来讨论实际的设置问题。鉴于我已有 Unfuddle SVN 存储库,设置开发环境的最佳方法是什么?将源代码放入MAMP htdocs目录中,并将eclipse工作空间指向那里? (许多SO答案推荐,IIUC)反之亦然,将代码放入默认的eclipse工作区,并将MAMP指向它?一个单独的 Projects/myProject1 目录,同时指向 MAMP 和 Eclipse?我担心这些选项中的任何一个都适用于初始设置,但我会深入工作并发现我的调试器不适用于一种配置或另一种配置,或者......我不知道,我的东西尚未想到会导致我本可以避免的问题,如果我知道就好了。
I'm in the process of switching over to developing on a Mac (woohoo, new Macbook Air) after years of Windows. My previous PHP development setup was:
- WAMP
- NotePad++
- XDebug
- TortoiseSVN and WinMerge (linked to an Unfuddle svn account)
I've just installed MAMP Pro (evaluation copy of Pro), Eclipse for PHP Developers (Version: Helios Service Release 2, Build id: 20110218-0911), and Subclipse. I'm trying to get over the "new to Mac" hump at the same time as switching dev tools. Which is making me question my setup eleventy billion times more than usual. I've read lots of StackOverflow questions and answers, googled the heck out of dev environment tutorials. What I really want to ask is "PLZ tell me what to do to get a good dev setup on my pretty new Mac!" but since that's probably not a very well-formed question, I'll try to narrow it down some. (But if you get bored reading this question, and just want to point me to a good book or tutorial, FEEL FREE!)
MAMP: OK, I think I'm fine on this one, right? It's pretty much the defacto standard, if I don't want to hammer everything together myself from what came pre-installed on my mac. I'm probably fine with dropping $60 to get MAMP Pro, as developers I know have told me the long-term convenience is worth it.
IDE: I used Eclipse for several years... but for Java development in a Windows environment. Part of me is happy to get back to a full IDE after a few years of PHP in Notepad++. But do I want Eclipse for PHP? EclipsePDT? Something else? I picked the version I have based on several StackOverflow answers mentioning that EclipsePDT didn't necessarily play well with Mac.
SVN: I took the StackOverflow hive mind advice to install Sublipse for the eclipse integrated SVN plugin. Yay, it looks like it's working, or at least I can browse my repository.
Debugging: Zend Debug comes with MAMP, right? I've never used it, but I was only semi-happy with XDebug + Notepad++ on my Windows box, as it kept locking up and requiring a Notepad++ restart multiple times a day. Will I love Zend more? Should I stick to XDebug? (Or, wait, does Zend only work with Eclipse PDT?)
Now for the actual setup questions. Given that I've got existing Unfuddle SVN repositories, what's the best way to set up my dev environment? Put the source code into the MAMP htdocs directory, and point the eclipse workspace there? (recommended by many SO answers, IIUC) Vice versa, with code into the default eclipse workspace, and point MAMP to it? A separate Projects/myProject1 directory, pointing both MAMP and Eclipse there? I'm concerned that any of these options will work for the initial setup, but that I'll get deep into the work and discover that my debugger won't work for one configuration or another, or... I dunno, something I haven't thought of yet will cause a problem I could have avoided, if only I'd known.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OSX(也是客户端版本)已经包含使用 PHP 开发所需的一切!哦,而且都是 64 位 :)(在 Snow Leopard 和 Lion 上)
默认情况下包含 Apache 2,并且可以从“系统偏好设置”->“启用”。共享(它的名称是“Web 共享”,或类似的名称:抱歉,我使用另一种语言的 OSX!)。
PHP 也是默认安装的。你只需要在
/etc/apache2/httpd.conf
中启用它:取消注释这一行:MySQL可以从二进制包安装,下载自:http://www.mysql.com/downloads/
您需要在 php.ini 文件 (
/etc/php.ini) 中更改的唯一内容ini
) 是:需要手动设置socket位置对于 MySQL,否则它将无法与 PHP 一起使用。
另外,请记住在
date.timezone
中设置一个值。当您安装 Lion 开发人员工具时,会自动安装 SVN 和 Git,这些工具可以从 http://developer 免费下载。 apple.com/mac(需要免费注册)。
如果您需要 Mercurial 或者您没有使用 Lion(因此您没有 XCode 4),请下载开发人员工具,然后下载名为
macports
的应用程序,它为数千种常见 UNIX 工具提供端口: http://www.macports.org/ 。一旦安装了MacPorts,您就可以使用一个简单的命令来安装所需的软件包:我没有为这些SCM使用任何图形工具,所以我不能真正建议您。我更喜欢旧的、简单的命令行!
如果您想使用 pecl 安装自定义扩展(Apple 的 PHP 默认发行版不包含一些扩展,例如
mcrypt
、gettext< /code> 和
intl
,仅列出三个最重要的名称)。说到编辑器……我真正喜欢和喜爱的是 Coda。它不是免费的,但如果您想使用 PHP 进行开发,它是完美的:http://panic.com/coda/ .
它还与 SVN 集成(但我们使用 Mercurial,所以我从未使用过该选项!)。
对于 (S)FTP,我推荐您使用 Cyberduck,它是免费的(开源):http://cyberduck.ch/ .另一个真正好的客户端应该是 Transmit,但它不是收费的(它来自 Panic,是生产 Coda 的同一家公司):我从未尝试过(我对 Cyberduck 非常满意!),但我听到了数以千计的关于它。
OSX (also the client version) already includes everything you need to develop with PHP! Oh, and it's all 64 bit :) (on Snow Leopard and Lion)
Apache 2 is included by default and can be enabled from System Preferences -> Sharing (its name is "Web Sharing", or something similar: I'm sorry but I use OSX in another language!).
PHP is installed by default too. You just need to enable it in
/etc/apache2/httpd.conf
: uncomment this line:MySQL can be installed from binary packages, downloaded from: http://www.mysql.com/downloads/
The only things you need to change in the php.ini file (
/etc/php.ini
) are:You need to manually set the socket location for MySQL or it won't work with PHP.
Also, remember to set a value in
date.timezone
.SVN and Git are installed automatically when you install the developer tools for Lion, which can be downloaded freely from http://developer.apple.com/mac (a free registration is required).
If you need Mercurial or if you aren't on Lion (so you don't have XCode 4), download the developer tools, then an application named
macports
, which provides ports for thousands common UNIX tools: http://www.macports.org/ . Once MacPorts is installed, you can install the required packages with a simple command:I don't use any graphical tool for these SCM, so I can't really suggest you. I prefer the old, plain command line!
Developer Tools (the package with XCode) is required also if you want to use pecl to install custom extensions (the default distribution of PHP Apple ships doesn't contain some extensions like
mcrypt
,gettext
andintl
, just to name the three most important).Speaking about editors... The one I really prefer and love is Coda. It's not free, but it's perfect if you want to develop in PHP: http://panic.com/coda/ .
It's also integrated with SVN (but we use Mercurial so I never used that option!).
For (S)FTP, I recommend you Cyberduck, which is free (open source): http://cyberduck.ch/ . Another really good client should be Transmit, but it's not fee (it's from Panic, the same company that produces Coda): I've never tried it (I'm really happy with Cyberduck!), but I heard thousands of good opinions about it.