简体   繁体   English

Xdebug在MAMP中不起作用

[英]Xdebug doesn't work in MAMP

I have MAMP with PHP 5.5.3 installed. 我安装了PHP 5.5.3的MAMP。

The ending of my php.ini file (MAMP/conf/php5.5.3/php.ini) is this: 我的php.ini文件(MAMP / conf / php5.5.3 / php.ini)的结尾是这样的:

[OPcache]
zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so"
  opcache.memory_consumption=128
  opcache.interned_strings_buffer=8
  opcache.max_accelerated_files=4000
  opcache.revalidate_freq=60
  opcache.fast_shutdown=1
  opcache.enable_cli=1

[xdebug]
xdebug.default_enable=1

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1

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

Still, xdebug doesn't work when testing with a var_dump(). 但是,使用var_dump()进行测试时,xdebug仍无法正常工作。

What else can I try? 我还能尝试什么?

EDIT: I have restarted MAMP every time I tried changing something. 编辑:我每次尝试改变时都重新启动了MAMP。 I also checked phpinfo(). 我还检查了phpinfo()。 It says here that I need to edit the file from MAMP, not from the finder. 在这里说我需要从MAMP编辑文件,而不是从finder编辑。 But I can't find where MAMP lets me go to the file... 但我无法找到MAMP让我去文件的地方......

Apparently, I was editing the wrong php.ini file... The correct php.ini is MAMP/bin/php/php5.5.3/conf/php.ini instead of MAMP/conf/php5.5.3/php.ini. 显然,我正在编辑错误的php.ini文件...正确的php.ini是MAMP / bin / php / php5.5.3 / conf / php.ini而不是MAMP / conf / php5.5.3 / php.ini。

I feel so stupid now. 我现在感觉很蠢。 :) :)

Everyone thanks for helping. 每个人都感谢您的帮助。

For people like me copying and pasting the php.ini settings from blogs/SO for xdebug without properly reading, my issue was the path 对于像我这样的人在没有正确阅读的情况下从blogs / SO for xdebug复制和粘贴php.ini设置,我的问题是路径

extensions/no-debug-non-zts-20151012

Please check the path of the extension on your machine and update accordingly. 请检查计算机上扩展程序的路径并进行相应更新。

Once you have php.ini set up, there will be a checkbox in the php panel of MAMP that says "activate xdebug". 一旦你设置了php.ini,MAMP的php面板中就会出现一个复选框,上面写着“激活xdebug”。 Check that. 检查一下。

Danger on newer mamp downloads, that comes with 7.3 php versions, and xdebug not supported yet as we can see here. 对于较新的mamp下载有危险,有7.3个php版本,xdebug尚不支持,我们可以在这里看到。

https://www.mamp.info/en/release-notes/mac/ https://www.mamp.info/en/release-notes/mac/

to make it work, just need to load latest PHP functional version 7.2.14: 为了使它工作,只需要加载最新的PHP功能版本7.2.14:

1- rename all the others php options in Applications/MAMP/bin/php, like '"_"php5.4.45' but not the 7.2.14 version, that will force mamp to use this version. 1-重命名Applications / MAMP / bin / php中的所有其他php选项,如'“_”php5.4.45'但不是7.2.14版本,这将迫使mamp使用此版本。

2- At the bottom of the ini file, in Applications/MAMP/bin/php/php7.2.14/conf/php.ini, Delete the ';' 2-在ini文件的底部,在Applications / MAMP / bin / php / php7.2.14 / conf / php.ini中,删除';' in xdebugg line. 在xdebugg行。

3- Restart Mamp 3-重启Mamp

4- Enjoy. 4-享受。

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

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