Xdebug doesn't work in MAMP
Asked Answered
M

5

6

I have MAMP with PHP 5.5.3 installed.

The ending of my php.ini file (MAMP/conf/php5.5.3/php.ini) is this:

[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().

What else can I try?

EDIT: I have restarted MAMP every time I tried changing something. I also checked phpinfo(). It says here that I need to edit the file from MAMP, not from the finder. But I can't find where MAMP lets me go to the file...

Micrococcus answered 23/12, 2013 at 15:4 Comment(3)
Did you restart Apache?Dingess
Did you bother checking phpinfo() to see if it's really being loaded?Man
Maybe this will help: #11618678Bier
M
12

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.

I feel so stupid now. :)

Everyone thanks for helping.

Micrococcus answered 23/12, 2013 at 15:30 Comment(4)
When using MAMP, use File->Edit Template->PHP->pick your version.ini to set preferences, much easier. And their default template doesnt have xdebug.remote_enable=1, which you need.Seidler
Ha, for me it was exactly the other way around. Finally after editing in MAMP/bin/php/, it worked.Rehearsal
I realize this is a couple years old, but want to let you know you're not alone. I just spent 2 hours smacking my head against the wall trying to figure this out. Thanks for the answer!Santoro
Apparently I was doing the same, and found it why it wasn't working, thanksNonsuch
B
1

Once you have php.ini set up, there will be a checkbox in the php panel of MAMP that says "activate xdebug". Check that.

Breeks answered 22/11, 2016 at 17:52 Comment(0)
L
1

For people like me copying and pasting the php.ini settings from blogs/SO for xdebug without properly reading, my issue was the path

extensions/no-debug-non-zts-20151012

Please check the path of the extension on your machine and update accordingly.

Lalise answered 1/5, 2017 at 16:13 Comment(0)
P
1

Danger on newer mamp downloads, that comes with 7.3 php versions, and xdebug not supported yet as we can see here.

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

to make it work, just need to load latest PHP functional version 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.

2- At the bottom of the ini file, in Applications/MAMP/bin/php/php7.2.14/conf/php.ini, Delete the ';' in xdebugg line.

3- Restart Mamp

4- Enjoy.

Pearlene answered 25/5, 2019 at 1:9 Comment(0)
G
0

You need to edit the php.ini file FROM WITHIN MAMP!!!

I tried for hours to try to open the php.ini from the finder and edit/save in textedit.

This worked:

enter image description here

Governorship answered 10/7, 2023 at 20:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.