Reputation: 1564
I'm having a problem building and installing Xdebug on Mac OS X with MAMP.
I searched online extensively so far and at the moment I am stuck on the part of Xdebug "Installation Wizard" that tells me to "Run: phpize" on the source code I downloaded.
When I run phpize
I get the following message:
new-host-2:xdebug-2.2.0 Dima$ phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
If I do a which phpize
I get:
new-host-2:xdebug-2.2.0 Dima$ which phpize
/usr/bin/phpize
This is not the version I want to use. I want to use the MAMP installed version of phpize
I assume since I want to install Xdebug on the MAMP version of PHP. This is puzzling because I added the MAMP specific PHP bin path to my .bash_profile already into the $PATH
variable.
If I run echo $PATH
I get:
new-host-2:xdebug-2.2.0 Dima$ echo $PATH
/opt/local/bin:/opt/local/sbin:/Applications/MAMP/bin/php/php5.4.3/bin:/Users/Dima/.rvm/gems/ruby-1.9.2-p290/bin:/Users/Dima/.rvm/gems/ruby-1.9.2-p290@global/bin:/Users/Dima/.rvm/rubies/ruby-1.9.2-p290/bin:/Users/Dima/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
The MAMP-specific PHP path shows up ahead of '/usr/bin'. The next thing I tried was running the MAMP-specific phpize
providing it the entire path manually like so:
new-host-2:xdebug-2.2.0 Dima$ /Applications/MAMP/bin/php/php5.4.3/bin/phpize
-bash: /Applications/MAMP/bin/php/php5.4.3/bin/phpize: Permission denied
Now I checked for permissions on these files in Finder and it shows that I have full permission to read and write the files this folder. I am a little lost.
Upvotes: 10
Views: 13961
Reputation: 2803
It's important to point out that the instructions in the "solution" are for Xdebug 2. We are at Xdebug 3 these days.
To enable Xdebug 3 in MAMP on macOS, do this:
Open Tools → phpinfo
Locate the line Loaded Configuration File and copy the complete path (/Application/MAMP/......
) of the php.ini file.
Open a Terminal and type the command open
and paste the copied complete path of the active php.ini file.
Add the following lines
[xdebug]
zend_extension = xdebug
xdebug.mode = debug
xdebug.show_local_vars=1
Restart the MAMP web server.
Check phpinfo again (refresh) and lookout for a line under ZEND engine starting with Xdebug vX.X.X....
. Further down you will find a section with the big Xdebug logo that shows you the version and what is (dis|en)abled.
If this doesn't appear, check for spelling mistakes, or other typos.
Consult the Xdebug documentation for additional settings which can be added at the php.ini file you opened like for instance profile. If you change the PHP version, you will have to repeat the procedure.
Alternatively, buy a MAMP Pro license that allows to do this from the MAMP control panel.
In order for the debugger (or profiler) to start you will need to add a magic cookie in browser requests. You can add these easily with a browser plugin like "Xdebug helper" for Chrome.
Upvotes: 1
Reputation: 1564
After more research and trial and error I managed to install it after doing the following things:
chmod u+x /Applications/MAMP/bin/php/php5.4.3/bin/*
. To open execute permissions on phpize and everything else in that pathUpvotes: 3
Reputation: 315
It’s easy.
In the *C:\MAMP\conf\php x.x.x * directory, open each php.ini related.
And then just put these lines in php.ini:
[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="C:\MAMP\bin\php\php5.5.0\ext\php_xdebug.dll"
Upvotes: 0
Reputation: 89
I tried the Dmitry Samuylov's answer, and it didn't quite work for me, so I googled some more and here's what did the trick.
Download and unpack the MAMP Components from SourceForge
Make a note of the path(s) that were not found during the phpize process. For me it was:
/Applications/MAMP/bin/php/php5.2.17/include/php/main/php.h
/Applications/MAMP/bin/php/php5.2.17/include/php/Zend/zend_modules.h
/Applications/MAMP/bin/php/php5.2.17/include/php/Zend/zend_extensions.h
Create the required path in your MAMP PHP directory. Again for me it was
/include/php/
Ensure the correct permissions on the directory
Find the components for your target PHP version (in my case 5.2.17) and copy them into the path you created in step 3.
Run the instructions for using the correct version of phpize from the Xdebug site
Upvotes: 8
Reputation: 176
I had the same problem, but I found a better solution.
Xdebug is already in MAMP.
Check your php.ini file:
/Applications/MAMP/conf/php5.x/php.ini
Go all the way down. You will see
[xdebug]
;zend_extension="/Applications/MAMP/bin/php5.X/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
Change that into
[xdebug]
zend_extension="/Applications/MAMP/bin/php5.X/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
Restart the server... Done!
See: Want to run Xdebug? MAMP is the easiest way…
Upvotes: 16