Return to site

Mamp Xdebug For Mac

broken image


I'm having a problem building / installing XDebug on Mac OSX 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. The MAMP php.ini will include the Xdebug module (xdebug.so) when you enable Xdebug in the MAMP Pro GUI. Hopefully this helps you. It still might be better to build a whole new PHP, with a more up-to-date Xdebug, to replace the outdated PHP 7.3.9 that is currently included with MAMP Pro 5.7.

  • 期间,需要确保本地PHP环境中,已启用了Xdebug。 此处先去看看,MAMP中的Apache是否已启用Xdebug,结果没有: 但是无意间发现了一.
  • Mac OS Configuring Xdebug with MAMP Prerequisites. These instructions are for Mac OS X (actually tested on version 10.9.2 Mavericks) with installed MAMP Application (actually tested on MAMP version 3.0.4). Configuration instructions. Open finder and navigate to.

From Joomla! Documentation

Xdebug is an extension which provides debugging and profiling capabilities, it runs in the server side and send the debugging information to any client capable of receive and read it, for this article we will install Xdebug in our local server and use Eclipse IDE as the client who will receive and interpret the debugging information. With Xdebug you will be able to study the behavior of your code step by step and also inspect the value of the all the variable at every execution step.

  • 1Linux OS
    • 1.1Installation
      • 1.1.1Method 1: From a Linux repository
    • 1.4Testing Xdebug and Eclipse IDE
  • 2Windows OS
    • 2.1Serverside (extension in PHP)
  • 3Mac OS
    • 3.1Configuring Xdebug with MAMP

Theses instructions should work fine on any Debian based distribution such as Debian, Ubuntu, LinuxMint, Xubuntu, Kbuntu and others. Need for speed high stakes for macular degeneration.

Installation

There are several ways to download and install Xdebug to your Linux box, you can do it from your software center, terminal or manual download.

Method 1: From a Linux repository

A Tip!

This is the recommended method because you will get updates and security patches automatically.

Option 1: Terminal

  • Open your terminal and type
  • Wait until the installation process finish

Option 2: Software center

  • Open the software center that comes with your distribution
  • Type in the search box 'Eclipse IDE'
  • Select 'Eclipse IDE' in the search result list
  • Click on the 'install' button
  • Wait until installation processes finish

Method 2: From a downloaded copy

  • Visit this page here and download the most recent version available
  • Do a double click on the downloaded file, your package manager should do the rest of the work automatically

Configuring Xdebug

Open your terminal and type:

sudo gedit /etc/php5/mods-available/xdebug.ini

If the file is empty try this location:

sudo gedit /etc/php5/conf.d/xdebug.ini

That command should open the text editor with the Xdebug configuration file.

At the end of the file content append the following text:

xdebug.remote_enable=on

xdebug.remote_handler=dbgp

xdebug.remote_host=localhost

xdebug.remote_port=9000

Mamp Xdebug For Mac Installer

Save changes and close the editor.

In your terminal, type:

sudo service apache2 restart

Note: You can set a different port number if you need to.

Configuring Eclipse IDE

  • Open Eclipse IDE.
  • On Eclipse go to: Toolbar Window Preferences PHP Debug
  • Find the option: 'PHP Debugger' and set it to 'Xdebug'
  • On Eclipse go to: Toolbar Window Preferences PHP Debug Installed Debugger
  • In the list make sure the port the 'Xdebug' option is set to the value '9000'
  • Save changes.
Mac

Note: You can set a different port number if necessary.

When you debug a PHP project, Xdebug stops the code execution of the current page and Eclipse IDE by default pops out a perspective with 2 views containing the internal Eclipse IDE web browser and a view with the current HTML output. If you don't like the internal web browser, you can use any other external web browser installed in your computer, such as Google Chrome, Chromium, Firefox and so on.

To set up a different web browser, follow these steps. If you are okay with the Eclipse internal browser, skip this part.

  • On Eclipse, go to: Toolbar Window Preferences General Web Browser
  • Make sure the option 'Use external browser' is selected.
  • If your preferred browser is on the list, select it and save changes. Skip the rest of this part.
  • If your preferred browser is not on the list, press the button 'New'
  • Set a name for your new browser, that is 'chrome'.
  • Set the location of your new browser, that is '/usr/bin/google-chrome'
  • If you don't know the location of the browser, open a terminal and use the command 'whereis browsername' to display the browser location. Note: Replace browsername with the name of your preferred browser, that is 'whereis google-chrome'. Copy one of the locations if there is more than one.
  • Save all changes.

Mamp Xdebug For Mac High Sierra

Testing Xdebug and Eclipse IDE

To test our new debugging tool, we need to create an Eclipse PHP project, set the debug configuration for our project and write a few lines of PHP code. This example assumes 3 things:

  1. You understand the Eclipse IDE concepts of 'workspace' and 'projects'. If not, please read this article: Configuring Eclipse IDE for PHP development/Linux#Understanding the folder structure
  2. You already have a working web server. If not, please read this article: Configuring a LAMPP server for PHP development/Linux desktop
  3. Your Eclipse workspace is located at the server's web root folder.

Configuring the workspace

  • If your current workspace is located at your server's web root, skip this part.
  • Open Eclipse IDE.
  • On Eclipse, go to: Toolbar File Switch Workspace Other
  • Press the button 'browse' and browse to the location of your server's web root folder. For example, '/home/youruser/lamp/public_html/'
  • Press 'OK' and wait until Eclipse IDE restarts and load the new workspace.

Configuring the test project

  • On Eclipse go to: Toolbar File New Other PHP PHP Project
  • Set the project name to 'xdebug-test' or anything you like.
  • Press 'Ok' to continue.
  • After this Eclipse IDE will automatically create a project folder like this '/home/youruser/lamp/public_html/xdebug-test/'. Also you should be able to visualize the new project at the Eclipse IDE Project Explorer view or Navigation view.
  • On Eclipse go to: Toolbar File New Other PHP PHP File
  • Set the file name to 'index.php'.
  • Press 'Ok' to continue.
  • After this Eclipse IDE will automatically create a PHP file like this '/home/youruser/lamp/public_html/xdebug-test/index.php'. Also you should be able to visualize the new file at the Eclipse IDE Project Explorer view or Navigation view.
  • Find the new 'index.php' file at the Eclipse IDE project explorer and open it by double clicking on it.
  • Place the following content to that file:
  • Save the changes.
  • Open your web browser and navigate to 'http://localhost/xdebug-test/index.php'
  • It should display a web page and output like this:

Configuring the test project debug information

  • On Eclipse, go to: Toolbar Run Debug configuration..
  • On the left list, find 'PHP Web Application' and do a double click on it to create a new configuration element.
  • Select the new configuration element to display its contents.
  • Set the name to 'xdebug-test' or anything you like.
  • Make sure the option 'Server debugger' is set to 'Xdebug'.
  • Make sure the option 'Break at first Line' is not checked.
  • In the option 'File' press the button 'Browse'. Find your project 'xdebug-test' and expand its contents. Then find and select the file 'index.php'.
  • Make sure that option URL looks something like this 'http://localhost/xdebug-test/index.php'
  • Press 'Apply' and 'Close' to save changes and continue.

Debugging the test project

As you can see, our 'index.php' file has several lines of code. With the debugger, we can study how those lines of code are executed one by one. To stop the execution, we need to set something called 'Breakpoint'. A Breakpoint is a 'mark' in our lines of code that indicate to the debugger to stop the execution and poll the var values. To set a Breakpoint on our code and test the debugger, follow these simple steps.

  • Open the 'index.php' of our test project.
  • Locate the line of code '$X = 8;' and do a click on it to place the blinking cursor there.
  • On Eclipse go to: Toolbar Run Toggle Breakpoint. You can also used the hotkey 'shift+ctrl+B' or simply do a double click on the line number of the line of code at the left side of your editor to toggle a Breakpoint.
  • When a Breakpoint is set, you should see it represented as a little circle next to the line number at the left side of your editor.

Now is the time to execute our project to see how the debugger helps us.

  • On Eclipse, go to: Toolbar Run Debug. You can also used the hotkey 'F11' or simply do a click in the 'little bug icon' located at the second toolbar from the top.
  • Eclipse will open the configured web browser and change to the 'Debug perspective'. The debug perspective contains a set of pre-configured views useful to do debugging tasks. Among them we have:
    • Debug view: It displays buttons to control the current running debug session. This view contains the current call stack.
    • Breakpoint view: display all your set breakpoints on any project file.
    • Variables view: It's basically a 'var dump' of all the PHP variables of your actual session. This view lets you easily navigate through any variable and child members of those variables.
    • Expressions view: here you can set custom expressions, for instance, '$X+$Y+$Z' and see the outcome of each expression without changing the code.
    • Internal browser view and output view: optional if you not configured an external browser, Eclipse IDE will display this view with the current page and the current page HTML output.
  • At this point our web page should look stopped and most likely the browser will show a blank page 'waiting' to load the rest of it.
  • Note that the current breakpoint has a 'little arrow' over the circle and the line of code is highlighted. This indicates the next line of code to be executed, also know as the 'current step'.
  • If you take a look at the 'variables view', the current value of '$X' should be '5'.
  • Go to the 'Debug view' and press the button 'step over' or use the hotkey 'F6' to go one step forward in the code execution.
  • Take another look at the 'variables view'. The current value of '$X' should be now '8'.
  • This way you can neatly study how your code and values changes step by step. You can also hover your mouse pointer over the variables names in the editor. Eclipse will pop up the current values.
  • Keep going forward until the end of the lines of code. At that point the web browser should display the final web page output.

This article or section is incomplete, which means it may be lacking information. You are welcome to assist in its completion by editing it as well. If this article or section has not been edited in several days, please consider helping complete the content.
This article was last edited by Tom Hutchison(talk| contribs) 6 years ago. (Purge)

Configuring Xdebug is split into two parts:

Xdebug

Serverside (extension in PHP)

Installation

First check if this extension is already installed. Create a new file with the content , save it in your webfolder (f.e. C:xampphtdocsphpinfo.php) and call it using your browser (f.e. http://localhost/phpinfo.php). The command PHPINFO will show you all information about installed plugins, their configuration and so on. If you see a headline called Xdebug, it is already downloaded and enabled.

The wave depicted looks as intimidating as the ones in the famous surfing location.10.10 YosemiteYosemite brought another UI refresh to the Mac, making things flatter and more modern. Computer backgrounds for mac. The space nerd in me likes the idea, but the execution of this one leaves dead-last on my list of favorites.10.8 Mountain LionJust like Snow Leopard before it, with Mountain Lion, Apple opted to clean up and revise the existing theme as opposed to changing directions for what would be a less-impactful release of OS X.10.9 MavericksMavericks marked the beginning of Apple's 'California location' naming scheme for Mac releases. This starscape is still one of my favorites.10.7 LionLion kept up the space theme, this time showing off the Andromeda galaxy.

To get the extension for a Windows-System, you have to download the DLL-file from http://xdebug.org/download.php that fit's to your PHP version, move it into the ext folder of your PHP-installation. If the file php_xdebug.dll exists, leave it there. It's most likely the right version, just that it's not enabled. This was f.e. the case for the last XAMPP package I used.

Enable Xdebug

On windows-systems you most likely just have one php.ini file for all configuration whereas on several Linux distributions you have a directory called conf.d in addition. If you have installed Xdebug on a Linux based system, you'll probably find a file xdebug.ini in there. Use this file instead if you have it (just not to mess-up the main config-file).

You enable the plugin by adding (or uncommenting) the following line to your config-file:

Please make sure you use zend_extension instead of extension which (not as extension) requires the full path to the extension-file.

Configuration

Please also read this introduction for configuration-details: http://xdebug.org/docs/remote

Here is an example of the configuration I use and some comments around that:

Clientside (configure your IDE)

If your IDE is not listed on http://xdebug.org/docs/remote#clients, you'll probably find a tutorial in the manual of your IDE.Feel free to add helpful tutorials here.

Configuring Xdebug with MAMP

Prerequisites

These instructions are for Mac OS X (actually tested on version 10.9.2 Mavericks) with installed MAMP Application (actually tested on MAMP version 3.0.4).

Configuration instructions

  • Open finder and navigate to

Mamp Xdebug Mac

(NOTE: is the php version that you have selected in the MAMP configuration)

  • Open the file php.ini with a text editor like e.g. TextWrangler
  • Find the section [xdebug]
  • Uncomment the line

by removing the ; character at the beginning of the line

  • Add after the line the following text, if not already existing
  • Save changes and close the editor
  • Restart your MAMP Server

Note: You can set a different port number if you need.

Retrieved from 'https://docs.joomla.org/index.php?title=Configuring_Xdebug_for_PHP_development&oldid=118112'

Introduction

I'm a fan of MAMP Pro (https://www.mamp.info/mamp-pro/). I do all my web development work on a Mac and I like the simplicity of having one MySQL server, one Apache (or Nginx) server, a centralized GUI tool for modifying /etc/hosts, and I can switch between any of the supported PHP versions by linking a virtual host to a different PHP-FPM service.

Where MAMP Pro fails me is that I am reliant on the PHP versions they have made a decision to build into the the app. Each PHP-FPM service is actually installed with the app's package. MAMP doesn't use the OS' PHP, and I'm mostly okay with this.

Unfortunately, the most recent version of PHP 7.3 that has been included in MAMP Pro 5.7 is PHP 7.3.9. There are probably a lot of reasons why I should be using a more current version of PHP (7.3.19), but this old PHP version also means that MAMP has bundled a bugged version of Xdebug (2.9.0). This particular version of Xdebug has a bug that will cause the PHPStorm debugger to trigger at the declaration of a function that contains a breakpoint rather than at the actual breakpoint. More information on this Xdebug 2.9.0 bug is at https://bugs.xdebug.org/view.php?id=1727.

Luckily, Xdebug is a module and not part of the actual PHP build. Modules can be compiled independently of the PHP code and I was able to easily upgrade the Xdebug that is included as part of MAMP. The Xdebug module does need to have knowledge of the PHP that you are going to install it into, so for that reason you can't simply link the PHP-FPM service to another Xdebug installed somewhere else for another PHP.

Xdebug has a great tool to assist: http://xdebug.org/wizard.

I use a Homebrew installation of PHP CLI instead of MAMP and simply following the standard Xdebug install or compile instructions would lead the an Xdebug module that was configured the the CLI PHP and not MAMP's PHP.

Xdebug

Note: You can set a different port number if necessary.

When you debug a PHP project, Xdebug stops the code execution of the current page and Eclipse IDE by default pops out a perspective with 2 views containing the internal Eclipse IDE web browser and a view with the current HTML output. If you don't like the internal web browser, you can use any other external web browser installed in your computer, such as Google Chrome, Chromium, Firefox and so on.

To set up a different web browser, follow these steps. If you are okay with the Eclipse internal browser, skip this part.

  • On Eclipse, go to: Toolbar Window Preferences General Web Browser
  • Make sure the option 'Use external browser' is selected.
  • If your preferred browser is on the list, select it and save changes. Skip the rest of this part.
  • If your preferred browser is not on the list, press the button 'New'
  • Set a name for your new browser, that is 'chrome'.
  • Set the location of your new browser, that is '/usr/bin/google-chrome'
  • If you don't know the location of the browser, open a terminal and use the command 'whereis browsername' to display the browser location. Note: Replace browsername with the name of your preferred browser, that is 'whereis google-chrome'. Copy one of the locations if there is more than one.
  • Save all changes.

Mamp Xdebug For Mac High Sierra

Testing Xdebug and Eclipse IDE

To test our new debugging tool, we need to create an Eclipse PHP project, set the debug configuration for our project and write a few lines of PHP code. This example assumes 3 things:

  1. You understand the Eclipse IDE concepts of 'workspace' and 'projects'. If not, please read this article: Configuring Eclipse IDE for PHP development/Linux#Understanding the folder structure
  2. You already have a working web server. If not, please read this article: Configuring a LAMPP server for PHP development/Linux desktop
  3. Your Eclipse workspace is located at the server's web root folder.

Configuring the workspace

  • If your current workspace is located at your server's web root, skip this part.
  • Open Eclipse IDE.
  • On Eclipse, go to: Toolbar File Switch Workspace Other
  • Press the button 'browse' and browse to the location of your server's web root folder. For example, '/home/youruser/lamp/public_html/'
  • Press 'OK' and wait until Eclipse IDE restarts and load the new workspace.

Configuring the test project

  • On Eclipse go to: Toolbar File New Other PHP PHP Project
  • Set the project name to 'xdebug-test' or anything you like.
  • Press 'Ok' to continue.
  • After this Eclipse IDE will automatically create a project folder like this '/home/youruser/lamp/public_html/xdebug-test/'. Also you should be able to visualize the new project at the Eclipse IDE Project Explorer view or Navigation view.
  • On Eclipse go to: Toolbar File New Other PHP PHP File
  • Set the file name to 'index.php'.
  • Press 'Ok' to continue.
  • After this Eclipse IDE will automatically create a PHP file like this '/home/youruser/lamp/public_html/xdebug-test/index.php'. Also you should be able to visualize the new file at the Eclipse IDE Project Explorer view or Navigation view.
  • Find the new 'index.php' file at the Eclipse IDE project explorer and open it by double clicking on it.
  • Place the following content to that file:
  • Save the changes.
  • Open your web browser and navigate to 'http://localhost/xdebug-test/index.php'
  • It should display a web page and output like this:

Configuring the test project debug information

  • On Eclipse, go to: Toolbar Run Debug configuration..
  • On the left list, find 'PHP Web Application' and do a double click on it to create a new configuration element.
  • Select the new configuration element to display its contents.
  • Set the name to 'xdebug-test' or anything you like.
  • Make sure the option 'Server debugger' is set to 'Xdebug'.
  • Make sure the option 'Break at first Line' is not checked.
  • In the option 'File' press the button 'Browse'. Find your project 'xdebug-test' and expand its contents. Then find and select the file 'index.php'.
  • Make sure that option URL looks something like this 'http://localhost/xdebug-test/index.php'
  • Press 'Apply' and 'Close' to save changes and continue.

Debugging the test project

As you can see, our 'index.php' file has several lines of code. With the debugger, we can study how those lines of code are executed one by one. To stop the execution, we need to set something called 'Breakpoint'. A Breakpoint is a 'mark' in our lines of code that indicate to the debugger to stop the execution and poll the var values. To set a Breakpoint on our code and test the debugger, follow these simple steps.

  • Open the 'index.php' of our test project.
  • Locate the line of code '$X = 8;' and do a click on it to place the blinking cursor there.
  • On Eclipse go to: Toolbar Run Toggle Breakpoint. You can also used the hotkey 'shift+ctrl+B' or simply do a double click on the line number of the line of code at the left side of your editor to toggle a Breakpoint.
  • When a Breakpoint is set, you should see it represented as a little circle next to the line number at the left side of your editor.

Now is the time to execute our project to see how the debugger helps us.

  • On Eclipse, go to: Toolbar Run Debug. You can also used the hotkey 'F11' or simply do a click in the 'little bug icon' located at the second toolbar from the top.
  • Eclipse will open the configured web browser and change to the 'Debug perspective'. The debug perspective contains a set of pre-configured views useful to do debugging tasks. Among them we have:
    • Debug view: It displays buttons to control the current running debug session. This view contains the current call stack.
    • Breakpoint view: display all your set breakpoints on any project file.
    • Variables view: It's basically a 'var dump' of all the PHP variables of your actual session. This view lets you easily navigate through any variable and child members of those variables.
    • Expressions view: here you can set custom expressions, for instance, '$X+$Y+$Z' and see the outcome of each expression without changing the code.
    • Internal browser view and output view: optional if you not configured an external browser, Eclipse IDE will display this view with the current page and the current page HTML output.
  • At this point our web page should look stopped and most likely the browser will show a blank page 'waiting' to load the rest of it.
  • Note that the current breakpoint has a 'little arrow' over the circle and the line of code is highlighted. This indicates the next line of code to be executed, also know as the 'current step'.
  • If you take a look at the 'variables view', the current value of '$X' should be '5'.
  • Go to the 'Debug view' and press the button 'step over' or use the hotkey 'F6' to go one step forward in the code execution.
  • Take another look at the 'variables view'. The current value of '$X' should be now '8'.
  • This way you can neatly study how your code and values changes step by step. You can also hover your mouse pointer over the variables names in the editor. Eclipse will pop up the current values.
  • Keep going forward until the end of the lines of code. At that point the web browser should display the final web page output.

This article or section is incomplete, which means it may be lacking information. You are welcome to assist in its completion by editing it as well. If this article or section has not been edited in several days, please consider helping complete the content.
This article was last edited by Tom Hutchison(talk| contribs) 6 years ago. (Purge)

Configuring Xdebug is split into two parts:

Serverside (extension in PHP)

Installation

First check if this extension is already installed. Create a new file with the content , save it in your webfolder (f.e. C:xampphtdocsphpinfo.php) and call it using your browser (f.e. http://localhost/phpinfo.php). The command PHPINFO will show you all information about installed plugins, their configuration and so on. If you see a headline called Xdebug, it is already downloaded and enabled.

The wave depicted looks as intimidating as the ones in the famous surfing location.10.10 YosemiteYosemite brought another UI refresh to the Mac, making things flatter and more modern. Computer backgrounds for mac. The space nerd in me likes the idea, but the execution of this one leaves dead-last on my list of favorites.10.8 Mountain LionJust like Snow Leopard before it, with Mountain Lion, Apple opted to clean up and revise the existing theme as opposed to changing directions for what would be a less-impactful release of OS X.10.9 MavericksMavericks marked the beginning of Apple's 'California location' naming scheme for Mac releases. This starscape is still one of my favorites.10.7 LionLion kept up the space theme, this time showing off the Andromeda galaxy.

To get the extension for a Windows-System, you have to download the DLL-file from http://xdebug.org/download.php that fit's to your PHP version, move it into the ext folder of your PHP-installation. If the file php_xdebug.dll exists, leave it there. It's most likely the right version, just that it's not enabled. This was f.e. the case for the last XAMPP package I used.

Enable Xdebug

On windows-systems you most likely just have one php.ini file for all configuration whereas on several Linux distributions you have a directory called conf.d in addition. If you have installed Xdebug on a Linux based system, you'll probably find a file xdebug.ini in there. Use this file instead if you have it (just not to mess-up the main config-file).

You enable the plugin by adding (or uncommenting) the following line to your config-file:

Please make sure you use zend_extension instead of extension which (not as extension) requires the full path to the extension-file.

Configuration

Please also read this introduction for configuration-details: http://xdebug.org/docs/remote

Here is an example of the configuration I use and some comments around that:

Clientside (configure your IDE)

If your IDE is not listed on http://xdebug.org/docs/remote#clients, you'll probably find a tutorial in the manual of your IDE.Feel free to add helpful tutorials here.

Configuring Xdebug with MAMP

Prerequisites

These instructions are for Mac OS X (actually tested on version 10.9.2 Mavericks) with installed MAMP Application (actually tested on MAMP version 3.0.4).

Configuration instructions

  • Open finder and navigate to

Mamp Xdebug Mac

(NOTE: is the php version that you have selected in the MAMP configuration)

  • Open the file php.ini with a text editor like e.g. TextWrangler
  • Find the section [xdebug]
  • Uncomment the line

by removing the ; character at the beginning of the line

  • Add after the line the following text, if not already existing
  • Save changes and close the editor
  • Restart your MAMP Server

Note: You can set a different port number if you need.

Retrieved from 'https://docs.joomla.org/index.php?title=Configuring_Xdebug_for_PHP_development&oldid=118112'

Introduction

I'm a fan of MAMP Pro (https://www.mamp.info/mamp-pro/). I do all my web development work on a Mac and I like the simplicity of having one MySQL server, one Apache (or Nginx) server, a centralized GUI tool for modifying /etc/hosts, and I can switch between any of the supported PHP versions by linking a virtual host to a different PHP-FPM service.

Where MAMP Pro fails me is that I am reliant on the PHP versions they have made a decision to build into the the app. Each PHP-FPM service is actually installed with the app's package. MAMP doesn't use the OS' PHP, and I'm mostly okay with this.

Unfortunately, the most recent version of PHP 7.3 that has been included in MAMP Pro 5.7 is PHP 7.3.9. There are probably a lot of reasons why I should be using a more current version of PHP (7.3.19), but this old PHP version also means that MAMP has bundled a bugged version of Xdebug (2.9.0). This particular version of Xdebug has a bug that will cause the PHPStorm debugger to trigger at the declaration of a function that contains a breakpoint rather than at the actual breakpoint. More information on this Xdebug 2.9.0 bug is at https://bugs.xdebug.org/view.php?id=1727.

Luckily, Xdebug is a module and not part of the actual PHP build. Modules can be compiled independently of the PHP code and I was able to easily upgrade the Xdebug that is included as part of MAMP. The Xdebug module does need to have knowledge of the PHP that you are going to install it into, so for that reason you can't simply link the PHP-FPM service to another Xdebug installed somewhere else for another PHP.

Xdebug has a great tool to assist: http://xdebug.org/wizard.

I use a Homebrew installation of PHP CLI instead of MAMP and simply following the standard Xdebug install or compile instructions would lead the an Xdebug module that was configured the the CLI PHP and not MAMP's PHP.

So some slightly modified instructions for when you get to the phpize part of the compile instructions found on http://xdebug.org/docs/install. My paths are based on a standard MAMP Pro installation on a Mac and are specific to PHP version 7.3.9 that comes with MAMP Pro 5.7.

Instructions

  1. In a new Terminal window, enter /Applications/MAMP/bin/php/php7.3.9/bin/php -i.
  2. Copy-and-paste the output of this command into the textarea that appears on http://xdebug.org/wizard.Click the form button to analyze your MAMP's phpinfo() output.
  3. Follow the presented instructions, including downloading the most recent version of Xdebug to your ~/Downloads folder (xdebug-2.9.6.tgz at the time of this post)
  4. If you used Mac OS's tar extractor instead of the tar command, you may have to go one level deeper for step 4 of the Xdebug instructions (cd ~/Downloads/xdebug-2.9.6/xdebug-2.9.6).
  5. For step 5 on that page, you are instructed to run phpize from within the source code directory. Substitute this command:/Applications/MAMP/bin/php/php7.3.9/bin/phpize.
  6. For step 6 on the Xdebug instructions, substitute this command:./configure --with-php-config=/Applications/MAMP/bin/php/php7.3.9/bin/php-config.
  7. Run make as normal from within the source code directory.
  8. Follow the cp instructions on step 8. It should be something like:cp modules/xdebug.so /Applications/MAMP/bin/php/php7.3.9/lib/php/extensions/no-debug-non-zts-20180731 (make sure you are still inside the Xdebug source code directory)
  9. You will not have to edit the MAMP php.ini file as instructed in step 9 of the Xdebug compile installation instructions. This is because we are replacing the older version of Xdebug with our newly compiled one. The MAMP php.ini will include the Xdebug module (xdebug.so) when you enable Xdebug in the MAMP Pro GUI.

Mamp Xdebug For Mac Windows 10

Hopefully this helps you. It still might be better to build a whole new PHP, with a more up-to-date Xdebug, to replace the outdated PHP 7.3.9 that is currently included with MAMP Pro 5.7. However, this was quicker and simpler for me to accomplish, probably because of the great instructions wizard included on xdebug.org, and this solution got me back in business with PHP 7.3.

Mamp Xdebug For Mac Os

Consider supporting continued Xdebug development financially: https://xdebug.org/support





broken image