macos 在 OS X 上进行 PHP 开发的最佳方式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9040532/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:48:47  来源:igfitidea点击:

Best way to do PHP development on OS X

phpmacosdebugging

提问by BetaRide

I just got a Mac with OS X (10.6.8). What options do I have to do serious PHP developement, including a debugger?

我刚买了一台装有 OS X (10.6.8) 的 Mac。我有哪些选项可以进行认真的 PHP 开发,包括调试器?

I don't ask about what IDE to use. I'm not sure what is the best way to get PHP including XDebug (or any other professional debugger) working. I heard that the Mac comes with Apache and PHP preinstalled. Where can I find any documentation about this. Should I just add MySql and work with this? Or should I go for MAMP or XAMPP. What would be the benefit of this installs over the built in?

我不问使用什么 IDE。我不确定让 PHP 包括 XDebug(或任何其他专业调试器)工作的最佳方法是什么。我听说 Mac 预装了 Apache 和 PHP。我在哪里可以找到有关此的任何文档。我应该只添加 MySql 并使用它吗?或者我应该选择 MAMP 还是 XAMPP。与内置安装相比,这种安装有什么好处?

I found a lot of descriptions about how to compile XDebug from scratch. Non of them worked for me. Isn't there an easier way of getting a debugger working for OS X?

我发现了很多关于如何从头编译 XDebug 的描述。他们都没有对我来说有效。没有更简单的方法让调试器在 OS X 上工作吗?

I'm also ready to upgrade the Mac to the latest OS X, if this is of any help.

如果有帮助的话,我也准备将 Mac 升级到最新的 OS X。

回答by Anton S

In the age of virtualization

在虚拟化时代

  • vagrant box full of ubuntu and zend CE server
  • zend studio for ide and zend debugger works out of the box
  • you can config it to use x-debug just apt-get it
  • 装满 ubuntu 和 Zend CE 服务器的流浪盒子
  • 适用于 ide 和 Zend 调试器的 Zend Studio 开箱即用
  • 您可以将其配置为使用 x-debug 只需 apt-get

this way you'll keep your os-x clean and have all the necessary stuff inside a portable/deployable virtual machine that runs on background or can be launched from any machine you might be using today or tomorrow

通过这种方式,您将保持 os-x 干净,并将所有必要的东西放在一个可移植/可部署的虚拟机中,该虚拟机在后台运行或可以从您今天或明天可能使用的任何机器启动

回答by BetaRide

After a lot more googling and try and error I found a very nice and easy to install solution which works great for me:

经过更多的谷歌搜索和尝试错误后,我发现了一个非常好且易于安装的解决方案,它对我很有用:

  1. Installed MacGDBp.
  2. Installed MAMP.
  3. Opened the php.iniat /Applications/MAMP/bin/php/php5.3.6/conf/php.iniand uncommented the only line containing the xdebug.sofile.
  4. Added this lines at the end of php.ini

    xdebug.remote_enable=1
    xdebug.remote_host=localhost 
    xdebug.remote_port=9000
    xdebug.remote_autostart=1
    
  5. After restarting apache MacGDBp stoped at the first PHP line.

  6. Done!
  1. 安装MacGDBp
  2. 安装MAMP
  3. 打开php.iniat/Applications/MAMP/bin/php/php5.3.6/conf/php.ini并取消注释包含该xdebug.so文件的唯一行。
  4. 在 php.ini 的末尾添加了这行

    xdebug.remote_enable=1
    xdebug.remote_host=localhost 
    xdebug.remote_port=9000
    xdebug.remote_autostart=1
    
  5. 重新启动 apache MacGDBp 后停止在第一行 PHP 行。

  6. 完毕!

回答by curtisdf

I use my MacBook Pro for PHP development every day, including XDebug. I've set it up both on Snow Leopard and on Lion. It's been a while, but does this link help you? http://maestric.com/doc/mac/apache_php_mysql_snow_leopard

我每天都使用我的 MacBook Pro 进行 PHP 开发,包括 XDebug。我在 Snow Leopard 和 Lion 上都设置了它。已经有一段时间了,但是此链接对您有帮助吗? http://maestric.com/doc/mac/apache_php_mysql_snow_leopard

For XDebug, what problems are you experiencing? I also wrote this guide on my blog for two simple ways of installing PHP extensions on a Mac: http://software.curtisfarnham.com/2011/10/30/how-to-install-php-extensions-in-mac-os-x-lion/

对于 XDebug,您遇到了哪些问题?我还在我的博客上写了这篇指南,介绍了在 Mac 上安装 PHP 扩展的两种简单方法:http: //software.curtisfarnham.com/2011/10/30/how-to-install-php-extensions-in-mac- os-x-lion/