在MAMP PRO上设置xdebug [英] Settings up xdebug on MAMP PRO

查看:381
本文介绍了在MAMP PRO上设置xdebug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Mamp Pro上设置xdebug,但没有成功.我在整个互联网上搜索,没有任何帮助.

首先,我只是尝试取消注释php.ini中的以下行:

zend_extension ="/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"

接下来,我尝试了该向导: http://xdebug.org/wizard.php

接下来,我尝试将这些行添加到php.ini中:

xdebug.default_enable = 1

xdebug.remote_enable = 1

xdebug.remote_handler = dbgp

xdebug.remote_host =本地主机

xdebug.remote_port = 9000

xdebug.remote_autostart = 1

没有任何帮助.我在phpinfo中看不到xdebug.

MAMP PRO版本:2.1.1

PHP版本:PHP 5.4.4

谢谢!

解决方案

由于发布MAMP 2.01 XDebug已包含在内.

已解决.这是对我有帮助的教程 :

  1. 启动MAMP

  2. 通过MAMP编辑php.ini模板文件以启用扩展名.通过文件->编辑模板-> PHP-> PHP php.ini

    编辑模板文件

  3. 编辑php.ini模板文件的底部,以便最终看起来像要输出配置文件一样

    [xdebug]
    zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
    xdebug.profiler_enable = 1
    xdebug.profiler_output_dir = "/tmp"
    ; DONT REMOVE: MAMP PRO php5.3.6.ini template compatibility version: 1
    

    如果您不希望输出配置文件,而只希望运行xdebug,请使用

    [xdebug]
    zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
    xdebug.profiler_enable = 0
    xdebug.profiler_output_dir = "/tmp"
    ; DONT REMOVE: MAMP PRO php5.3.6.ini template compatibility version: 1
    

    现在,当您遇到错误时,如果将它们发送到标准输出,您将看到类似这样的内容

    我的php.ini文件:

  4. 保存编辑的模板并关闭编辑窗口

  5. 重新启动MAMP

  6. 打开MAMP的WebStart页面,然后导航至PHPInfo选项卡.检查以确保Xdebug正在运行.在浏览器窗口中搜索"Xdebug"使此操作变得容易.

  7. 如果使用与我相同的设置,则在运行PHP代码时,Xdebug会将cachegrind.out文件放在您的"/tmp"目录中.打开您的"/temp"目录并运行您的PHP文件之一,以确保其正常运行.您可以通过打开终端并运行

    来在finder中打开"/tmp"目录.

    open /tmp
    

  8. 现在,您可以使用能够理解这些cachegrind.out文件的任何应用程序来查看配置文件数据.诸如 KCacheGrind (Linux/Windows,KDE), xdebugtoolkit ,以及 Webgrind .我走了简单的路线,并使用了webgrind. Webgrind是一个简单的基于Web的应用程序,您可以在MAMP上本地运行,并且只需单击一下即可自动查找cachegrind.out文件.继续进行设置webgrind的步骤.

  9. 下载Webgrind

  10. 在MAMP上设置Webgrind主机以运行Webgrind

  11. 在本地MAMP安装上访问Webgrind URL设置.我的只是webgrind/

  12. 如果您已经有cachegrind输出文件,则应该能够在自动(最新)"下拉列表中选择文件,或者将其保留为自动",然后单击更新"以显示配置文件数据

  13. 投掷庆祝拳头

I am trying to set up xdebug on mamp pro with no success. I searched all over the internet, nothing helped me.

First I have tried just to uncomment the following line in php.ini:

zend_extension="/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"

Next, I've tried the wizard: http://xdebug.org/wizard.php

Next, I've tried adding these lines to php.ini:

xdebug.default_enable=1

xdebug.remote_enable=1

xdebug.remote_handler=dbgp

xdebug.remote_host=localhost

xdebug.remote_port=9000

xdebug.remote_autostart=1

Nothing helps. I can't see xdebug in my phpinfo.

MAMP PRO Version: 2.1.1

PHP Version: PHP 5.4.4

Thanks!

解决方案

Since release of MAMP 2.01 XDebug is already included.

Solved. Here's the tutorial that helped me:

  1. Start MAMP

  2. Edit php.ini template file through MAMP to enable the extension. Edit the template file via File -> Edit Template -> PHP -> PHP php.ini

  3. Edit bottom of php.ini template file so that it ends up looking like if you want profile output

    [xdebug]
    zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
    xdebug.profiler_enable = 1
    xdebug.profiler_output_dir = "/tmp"
    ; DONT REMOVE: MAMP PRO php5.3.6.ini template compatibility version: 1
    

    If you don’t want profile output and just want xdebug running then use

    [xdebug]
    zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
    xdebug.profiler_enable = 0
    xdebug.profiler_output_dir = "/tmp"
    ; DONT REMOVE: MAMP PRO php5.3.6.ini template compatibility version: 1
    

    Now when you have errors, if they are sent to standard out, you will see something like this

    My php.ini file:

  4. Save edited template and close edit window

  5. Restart MAMP

  6. Open MAMP’s WebStart page and navigate to PHPInfo tab. Check to make sure that Xdebug is running. Doing a search in the browser window for "Xdebug" makes this easy.

  7. If you used the same settings that I have above, when you run PHP code, Xdebug will put the cachegrind.out files in your ‘/tmp’ directory. Open your ‘/temp’ directory and run one of your PHP files to make sure it is working correctly. You can open the ‘/tmp’ directory in finder by opening the terminal and running

    open /tmp
    

  8. Now you can use any app that understands those cachegrind.out files to view the profile data. Apps like KCacheGrind (Linux/Windows, KDE), WinCacheGrind (Windows), xdebugtoolkit, and Webgrind.  I went the simple route and used webgrind. Webgrind is a simple web based application that you can run locally on MAMP and it will look for the cachegrind.out files automatically with just one click. Continue for steps on setting up with webgrind.

  9. Download Webgrind

  10. Setup Webgrind host on MAMP to run Webgrind

  11. Visit webgrind url setup on your local MAMP installation. Mine was simply webgrind/

  12. If you already have cachegrind output files you should be able to select the file in the "Auto (newest)" dropdown or leave it select at Auto and click update which will reveal the profile data

  13. Throw a celebratory fist pump

这篇关于在MAMP PRO上设置xdebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆