Return to site

Xdebug For Mac

broken image

 

 

 

Xdebug is an extension for PHP to assist with debugging and development. It contains a single step debugger to use with IDEs; it upgrades PHP's vardump function; it adds stack traces for Notices, Warnings, Errors and Exceptions; it features functionality for recording every function call and variable assignment to disk; it contains a profiler. A must have for everyone thats debugging, profiling and tracing PHP code with Xdebug. This extension will help you to enable/disable debugging, profiling and tracing easily, instead of juggling around with POST/GET variables or cookies. Hi friends, I have latest PHP Version 7.1.9 and I have installed Apache server all are running fine. I am not able to configure Xdebug in eclipse environment. I am not getting Xdebug in php.ini after pasting phpxdebug-2.5.5-7.1-vc14.dll in D:xamppphpext. Please guide me. 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.Download Xdebug

*

Download the Xdebug extension compatible with your PHP version and install it as described in the installation guide. 

 If you are using an AMP package, the Xdebug extension may be already installed. Refer to the instructions specific for your package. Integrate Xdebug with the PHP interpreter

*

Open the active php.ini file in the editor: 

*

 In the Settings/Preferences dialog Ctrl+Alt+S, click PHP under  Languages & Frameworks. 

*

 On the PHP page that opens, click next to the CLI Interpreter field. 

*

 In the CLI Interpreters dialog that opens, the Configuration File read-only field shows the path to the active php.ini file. Click Open in Editor. 

*

To disable the Zend Debugger and Zend Optimizer tools, which block Xdebug, remove or comment out the following lines in the php.ini file:  zend_extension=<path_to_zend_debugger> zend_extension=<path_to_zend_optimizer> 

*

 To enable Xdebug, locate or create the [xdebug] section in the php.ini file and update it as follows: [xdebug] zend_extension='<path to xdebug extension>' xdebug.remote_enable=1 xdebug.remote_port='<the port for Xdebug to listen to>' (the default port is 9000) 

 In PHP 5.3 and later, you need to use only zend_extension, not zend_extension_ts, zend_extension_debug, or extension. 

 To enable multi-user debugging via Xdebug proxies, locate the xdebug.idekey setting and assign it a value of your choice. This value will be used to register your IDE on Xdebug proxy servers. 

*

Save and close the php.ini file. 

*

Verify Xdebug installation by doing any of the following:

*

 In the command line, run the following command:

The output should list Xdebug among the installed extensions:

*

Create a php file containing the following code: <?php phpinfo(); 

 Open the file in the browser. The phpinfo output should contain the Xdebug section: Configure Xdebug in PhpStorm

*

 In the Settings/Preferences dialog Ctrl+Alt+S, select Languages & Frameworks | PHP. 

*

Check the Xdebug installation associated with the selected PHP interpreter:

*

 On the PHP page, choose the relevant PHP installation from the CLI Interpreter  list and click next to the field. The list shows all the PHP installations available in PhpStorm, see Configure local PHP interpreters and Configure remote PHP interpreters. 

* The CLI Interpreters dialog that opens shows the following: 

*

 The version of the selected PHP installation. 

*

 The name and version of the debugging engine associated with the selected PHP installation (Xdebug or Zend Debugger). If no debugger is configured, PhpStorm shows the corresponding message: 

 Alternatively, open the Xdebug checker, paste the output of the phpinfo(), and click Analyze my phpinfo() output. Learn more about checking the Xdebug installation in Validate the Configuration of a Debugging Engine. 

*

Define the Xdebug behaviour. Click Debug under the PHP node. On the Debug page that opens, specify the following settings in the Xdebug area:

*

 In the Debug Port field, appoint the port through which the tool will communicate with PhpStorm.  This must be exactly the same port number as specified in the php.ini file: By default, Xdebug listens on port 9000. 

*

To have PhpStorm accept any incoming connections from Xdebug engines through the port specified in the Debug port field, select the Can accept external connections  checkbox. 

* Select the Force break at the first line when no path mapping is specified checkbox to have the debugger stop as soon as it reaches and opens a file that is not mapped to any file in the project on the Servers page. The debugger stops at the first line of this file and Examine/update variables shows the following error message: Cannot find a local copy of the file on server <path to the file on the server> and a link Click to set up mappings. Click the link to open the Resolve Path Mappings Problem dialog and map the problem file to its local copy. 

 When this checkbox cleared, the debugger does not stop upon reaching and opening an unmapped file, the file is just processed, and no error messages are displayed. 

*

 Select the Force break at the first line when the script is outside the project  checkbox to have the debugger stop at the first line as soon as it reaches and opens a file outside the current project. With this checkbox cleared, the debugger continues upon opening a file outside the current project. 

*

 In the External Connections area, specify how you want PhpStorm to treat connections received from hosts and through ports that are not registered as deployment server configurations. 

*

Ignore external connections through unregistered server configurations: Select this checkbox to have PhpStorm ignore connections received from hosts and through ports that are not registered as deployment server configurations. When this checkbox is selected, PhpStorm does not attempt to create a deployment server configuration automatically. 

*

Break at first line in PHP scripts: Select this checkbox to have the debugger stop as soon as connection between it and PhpStorm is established (instead of running automatically until the first breakpoint is reached). Alternatively turn on the Run | Break at first line in PHP scripts option from the main menu. 

*

Max. simultaneous connections: Use this spin box to limit the number of external connections that can be processed simultaneously. 

By default, PhpStorm only listens for incoming IPv4 connections. To enable IPv6 support, you need to make adjustments in PhpStorm JVM options: 

*

 Select Help | Edit Custom VM Options from the main menu. 

*

 In the .vmoptions file that opens, delete the -Djava.net.preferIPv4Stack=true line. 

*

Restart PhpStorm.Configure Xdebug for using in the On-Demand mode

 PhpStorm 2016.2 and later supports the On-Demand mode, where you can disable Xdebug for your global PHP installation and have it enabled automatically on demand only when you are debugging your command-line scripts or when you need code coverage reports. This lets your command line scripts (including Composer and unit tests) run much faster. Xdebug For Mac Catalina

*

Disable Xdebug for command-line scripts:

*

 In the Settings/Preferences dialog Ctrl+Alt+S, select PHP under  Languages & Frameworks. 

*

 From the PHP executable list, choose the relevant PHP interpreter and click next to it. In the CLI Interpreters dialog that opens, click the Open in Editor link next to the Configuration file: <path to php.ini> file. Close all the dialogs and switch to the tab where the php.ini file is opened. 

*

 In the php.ini file, find the [xdebug] section and comment the following line in it by adding ; in preposition:  ;[xdebug] ;zend_extension = '<full_path_to_xdebug>' 

*

 Open the CLI Interpreters dialog and click next to the PHP executable field. PhpStorm informs you that debugger is not installed: 

*

 To enable PhpStorm to activate Xdebug when it is necessary, specify the path to it in the Debugger extension field, in the Additional area. Type the path manually or click and select the location in the dialog that opens. Configure Xdebug for using in the Just-In-Time mode

 PhpStorm supports the use of Xdebug in the Just-In-Time (JIT) mode so it is not attached to your code all the time but connects to PhpStorm only when an error occurs or an exception is thrown. The Xdebug operation mode is toggled through the xdebug.remote_mode setting, which is by default set to req. The mode is available both for debugging command-line scripts and for web server debugging. 

 Depending on whether you are going to debug command-line scripts or use a Web server, use one of the scenarios below. Command-line scripts

For debugging command-line scripts, specify the custom -dxdebug.remote_mode=jit directive as an  additional configuration option:

*

 In the Settings/Preferences dialog Ctrl+Alt+S, navigate to Languages & Frameworks | PHP. 

*

 From the PHP executable list, choose the relevant PHP interpreter and click next to it. 

*

 In the CLI Interpreters dialog that opens, click next to the Configuration options field in the Additional area. 

*

In the Configuration options dialog that opens, click to add a new entry, then type -dxdebug.remote_mode in the Configuration directive  field and jit in the Value field. 

 When you click OK, you return to the CLI Interpreters dialog where the Configuration options field shows -dxdebug.remote_mode=jit. Web server debugging

 From the main menu, choose Run | Web Server Debug Validation. 

 In the Validate Remote Environment that opens, choose the Web server to validate the debugger on. 

*

Choose Local Web Server or Shared Folder to check a debugger associated with a local Web server. 

*

Path to Create Validation Script: In this field, specify the absolute path to the folder under the server document root where the validation script will be created. For Web servers of the type Inplace, the folder is under the project root. 

 The folder must be accessible through http. 

*

URL to Validation Script: In this field, type the URL address of the folder where the validation script will be created. If the project root is mapped to a folder accessible through http, you can specify the project root or any other folder under it. 

*

 Choose Remote Web Server to check a debugger associated with a remote server. 

*

Path to Create Validation Script: In this field, specify the absolute path to the folder under the server document root where the validation script will be created. The folder must be accessible through http. 

*

Deployment Server: In this field, specify the server access configuration of the type Local Server or Remote Server to access the target environment. For details, see Configure synchronization with a Web server. 

 Choose a configuration from the list or click Browse in the Deployment dialog. Install Xdebug For Mac

Click Validate to have PhpStorm create a validation script, deploy it to the target remote environment, and run it there. 

 Open the php.ini file which is reported as loaded and associated with Xdebug. 

*

In the php.ini file, find the [xdebug] section and change the value of the xdebug.remote_mode from the default req to jit. 

 See also Just-In-Time debugging and PHP Exception Breakpoints with PhpStorm and XdebugConfigure Xdebug running in a Docker container

 To configure Xdebug running in a Docker container, provide the Xdebug-specific parameters in the Dockerfile, for example:  #Set up debugger RUN echo 'xdebug.remote_enable=1' >> /etc/php/7.0/apache2/php.ini RUN echo 'xdebug.remote_host=your_host_name_or_ip' >> /etc/php/7.0/apache2/php.ini 

 In this example, we're modifying /etc/php/7.0/apache2/php.ini providing the path to the Xdebug extension, and the remote_enable and remote_host Xdebug parameters. 

 Note that the xdebug.remote_host value should be replaced with the IP address of the machine where PhpStorm is running, which is accessible from the Docker container. If you are using Docker for Windows or Docker for Mac, you can set xdebug.remote_host to host.docker.internal, which automatically resolves to the internal address of the host, letting you easily connect to it from the container. Configure Xdebug running on a Vagrant instance

 To configure Xdebug running on a Vagrant instance, connect to the Vagrant machine and provide the Xdebug-specific parameters in the php.ini file:  [xdebug] zend_extension='<path to xdebug extension>' xdebug.remote_enable=1 xdebug.remote_host=10.0.2.2 xdebug.remote_port=9000 

 Note that the xdebug.remote_host value is 10.0.2.2. This is the gateway used in the default Vagrant setup, which allows connecting from the instance to host where PhpStorm is running. How to configure XDebugContents

*1How to configure XDebug

*1.3General Information

*1.5How to on MAC OS X Snow Leopard

*1.5.1Built in php and apache

*1.7How to configure xdebug with WAMP

*2How to build Xdebug (useful for php5.3)

*2.1Ubuntu

*2.2TroubleshootingOverview 

* This document describes the installation of xdebug. There are separate sections for Linux, Mac OS X and Windows users. However, the information in How to on Linux may be interesting for Windows users as well. Please send your comments to users@php.netbeans.org if you have any comments or questions.Other Useful Documents 

* see installation, configuration instructions: 

*XDebug wizard 'VERY USEFUL''DON'T OVERLOOK A MUST USE'

*Command-line PHP interpreter and how to specify it in Netbeans

* Various XDebug-related threads at the NetBeans PHP Users Forum, especially Won't Connect to XDebugGeneral Information

* Edit PHP Configuration - name of configuration file is php.ini

* The location of php.ini differs between operating systems, Linux distributions, types of installation (from packages or sources), and/or Windows-based solution stacks (WAMP, XAMP)

* Typically, more than one php.ini file exists. 

Important note for WAMP: xdebug configuration (below) must be added in WAMP's apache-directory php.ini (e.g. C:wampbinapacheApache.x.y.zbinphp.ini), otherwise it won't be loaded by Apache. Thus configured, it will work in NetBeans, but if you experience 'call to unidentified function' in the debug window, add the xdebug configuration to C:wampbinphpphp.a.b.cphp.ini as well.

* Xdebug configuration is either inside php.ini or in another ini file often called xdebug.ini - this ini file is then shared between both configurations (Script and Local Web Server)

*Xdebug is incompatible with the Zend Optimizer and Zend Studio Debugger extensions. These extensions should be commented out. See user's comment:

*NOTICE: From PHP 5.3 onwards, you need to use zend_extension and not zend_extension_ts.Tips from the NetBeans Forums

A user provides the following additional tips:

1: Read this great set of articles that explain xDebug in clear, coherent, plain English - Stefan Priedsch's articles at [1] - particularly, parts 1 and 4

There's some crucial subtle details and context you might not already understand. Also, it'll remind you why it's worth all this effort!

2: Use http://www.xdebug.org/find-binary.php

This app is provided by the xdebug guys. You can copy and paste in your PHPinfo, and it gives you the correct version with step-by-step compilation instructions. Many xDebug problems seem to come from tiny mismatches between the exact PHP release you use, and the exact version of xDebug you use. If you simply downloaded the latest version xdebug, or if you got xdebug off a repository, this is probably part of your problem.

3: Get xdebug's debugclient working on localhost first, then add Netbeans.

If Netbeans is failing to connect, chances are it's a problem with xDebug and nothing to do with Netbeans. First, try to achieve the simplest possible xDebug set up: use the bundled command line client 'debugclient' instead of netbeans, on localhost, debugging simple php code (e.g. a phpinfo file), with any firewalls and other competing factors or config disabled or removed. When you've got this running, then your fight with Netbeans will be on solid ground, and will probably be surprisingly easy.

Instructions on installing Debugclient are cunningly hidden right at the bottom of http://www.xdebug.org/docs/install

As for actually using it, there's almost nothing I could find on xdebug's own site, but there's good tips on the really helpful page Installing the XDebug Debugger - look under 'Can I debug locally?' near the bottom. The important thing is, if debugclient hangs on 'Waiting to connect', it hasn't necessarily failed, it could be working and listening for a session from your browser.

I personally went as far as setting up an Ubuntu Virtualbox on my Windows machine. This took all Windows-related complications out of the equation, and meant I could casually wipe the whole drive and start all over again when things got complicated. I'd recommend this as it gives you complete control and guarantees no conflicting config files. People have spent days, even more than a week or two fighting to get xdebug to work - spend time now to save time later!

Here's a collection of tips I picked up from 100s of forum posts and from experience:-

* Always check there aren't any other php.ini files you haven't configured (on *nix, 'find / -name php.ini'). E.g. there are often different php.inis for command line and for web server PHP.

* (on *nix) Use the command 'netstat -a | grep tcp' when you need to see what's going on with port 9000

* Generally, 'fail to bind' type errors are a sign that something is using the port in question. If netstat says port 9000 is busy listening, this is what it's supposed to do. It might be waiting for a browser to start a session - try it! I think http://www.thierryb.net/pdtwiki/index.php?title=Using_PDT_:_Installation_:_Installing_the_XDebug_Debugger has how.

* Only use those socket-based php test files like https://blogs.oracle.com/netbeansphp/entry/howto_check_xdebug_installation sparingly. When they hang, they can tie up the port and complicate the question. Reboot and restart Apache often. Also, don't forget to try them through a browser as well as the command line. If this gives you a fancy error screen with backtraces and some orange colouring, that's a good sign - that's xdebug at work!

* Don't obsess over every php.ini option. Most of the defaults are fine. The really important ones are the host, and making sure that whatever port you set in php.ini is matched by your client.

* Occasionally, on some systems, localhost isn't localhost. If this might affect you (it probably doesn't), put 127.0.0.1 instead.

* Look at your other debugging-related php.ini settings. Turn them on. This isn't essential, but it helps a lot. I also uncommented the report_zend_debug = 0 line to make sure that this is off and not competing. I don't know if this helped, but xdebug now works, so it didn't hurt.

* In your phpinfo, check that 'Debug build' IS 'No'. If it's 'yes', this could be a big problem. Research it. I believe you might need to reinstall PHP, to make sure that it is 'no'.

* Make sure there's nothing Zend other than xDebug in either phpinfo, php -m on the command line (if you've got command line php) or php.ini. If there's any other Zend modules in php.ini, comment them out.

* If you are mapping server paths to project paths, you must map the full project folders to each other, not the parent folders. For example, the mapping

will not work. The mapping 

will work.

4. XDebug Port Stopped by SELinux

On Linux systems, if your SELinux policies are enforced, NetBeans will not be able to connect. The reason is that SELinux stops apache from any other port other than the known 80. You can tackle the problem by passing the xdebug port (9000) for apache in the SELinux, using the following command:

semanage port -a -t http_port_t -p tcp 9000

Optionally, you can disable System Default Enforcing of SELinux.How to on Linux

* e.g. Ubuntu files layout (xdebug configuration is in both php.ini files):

* alternative Ubuntu files layout (xdebug configuration is in xdebug.ini shared between both configurations. If this is your case then you better add related directives to xdebug.ini. See article Xdebug On Ubuntu):

* php.ini (or xdebug.ini) should contain at least following settings (see all settings).

*NOTICE: From PHP 5.3 onwards, you need to use zend_extension and not zend_extension_ts.

* Nginx users: Note that restarting nginx will not reload php.ini! You will need to restart PHP, or your server.

* /path/to/xdebug.so is just example. Check that the file really exists on given path. 

* For Script verify that Xdebug appears in the Zend module lists after: php -m

* For Local Web Server verify that Xdebug appears in the Zend modules (not PHP Modules) after: : php -mf path_to_ini_file/php.ini

* For Local Web Server you can alternatively create a phpinfo.php file containing the line '<?php phpinfo(); ?>', run and watch whether information about Xdebug will be displayed

* Optionally enable Xdebug logging by adding into php.ini also: xdebug.remote_log=/log_path/xdebug.log

* Optionally enable NetBeans PHP debugger logging by starting NetBeans with -J-Dorg.netbeans.modules.php.dbgp.level=400 or by editing netbeans.conf 

* whenever php.ini is modified don't forget restart web server (not needed for Script)

* see Howto check xdebug installation, XDebug on Ubuntu

 How to on MAC OS X Snow Leopard 

A google search shows many blogs that state that installing xdebug on MAC is tedious and problematic. Their usual recommendation is to download some precompiled version to be safe. Well, this is probably the easiest way to install XDebug but if it doesn't work then you are in trouble. Compiling your own version of xdebug is actually easier than you would think and you don't even need to use the command line so much.  Built in php and apache 

I started with a fresh Snow Leopard installation that comes with prebuilt apache and php.  Get Xdebug Sources and Install 

* Download your xdebug sources from the xdebug download page. Use the Tailored Installation Instructions to download the correct version. After you press analyze my phpinfo() output you should get a recommended version to download with all necessary instructions for installation. 

* If there is a php.ini file in your /etc/ folder, add the following to the end. If there is not a php.ini file then simply create the php.ini file. There may be a php.ini.default file. Don't update this file but rather create a new php.ini and add only xdebug directives into it. Change path to xdebug.so to your path, of course. 

* Above is my entire php.ini file. All other directives are saved in php.ini.default. 

*Note: xdebug.remote_log is optional.

*Note: (probably works with OS X versions before 10.8 Mountain Lion) If you are using PHP from the MAMP package, your php.ini file is in /Applications/MAMP/conf/php5/php.ini by default and the default directory in which to install xdebug.so is /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/.

*IMPORTANT for Mac OS X 10.8 (Mountain Lion): Contrary to the note above, you have to make the changes in /Applications/MAMP/bin/php/php5.x.y/conf/php.ini, where php5.x.y is the active PHP version chosen in MAMP Verify installation 

* Check the installation either in a browser or in the command line, depending on whether you want to debug a web page or a cli script. The output is the same as on linux or on WIN. 

* For web page run phpinfo() again. 

* For command line run the following. You will get longer output but this is the most important part of the output. 

* and that's it!Notes on Windows Configuration

* php.ini location hint for Local Web Server for XAMP on Windows: c:xampapachebinphp.ini 

* php.ini location hints for Script(CGI/CLI) for XAMP on Windows: c:xamppphpphp.ini

* for Windows use zend_extension_ts instead of zend_extension (e.g. zend_extension_ts=c:pathtophp_xdebug.dll). Again c:pathtophp_xdebug.dll must exist.

*NOTICE: From PHP 5.3 onwards, you need to use zend_extension and not zend_extension_ts.

* For more information, please see Configuring PHP Development Environment in Windows.How to configure xdebug with WAMP

* installing xdebug on WAMP is a bit diferrent and requires another steps to sucesfully load module. I focus on the easiest use case, installation using precompiled .dll. Prerequisities

* I assume these prerequisities: 

* you have latest version of WAMP installed. That's WAMP 2.0 when writing this tutorial (Apr 15, 2009). These includes: 

* Apache 2.2.11 

* PHP 5.2.9-1 

* I don't care about MySQL at this moment .., Steps

* if you didn't customize your installation paths then you should find php in <wamp_folder>bin

* folder ext is used for extension and we used it to copy xdebug's dll there. However, you can use whatever folder you want. 

* download xdebug from http://www.xdebug.org/download.php. Carefully choose version you download! There is a description you should read on download page! I downloaded php_xdebug-2.0.4-5.2.8.dll for WAMP2 with prerequisities above. Consult our FAQ at the end of this page if you need more help on choosing a version. 

* open your php.ini that is easily accesible from tray. Wamp tray icon -> PHP -> php.ini 

* add following lines to your php.ini. Use full path! (change your .dll name to match your version, of course)

*NOTICE: From PHP 5.3 onwards, you need to use zend_extension and not zend_extension_ts.

* note that you always use zend_extension_ts unless you intentionally installed non thread safe apache version

* restart WAMP services (restart Apache is enough)

* open localhost (or WAMP server default page) and check if xdebug is between Loaded Extensions

* click on phpinfo() on default WAMP page or create file containing <? phpinfo() ?>. You should see the same as for Linux tutorial above: 

* You can check your configuration using simple script written by Radek Matous and posted on blog.oracle.com. If you are using WAMP then you don't have php on path, most probably. All you have to do is to copy this code to php file and then call it from browser with $_GET variable in url ?XDEBUG_SESSION_START=mysession. Let's say your file i called dbgtest.php and it's in web directory. All you have to do is type http://localhost/dbgtest.php?XDEBUG_SESSION_START=mysession. 

* If xdebug is properly installed then script started in step 1. should print message like 'connection established: Resource id #5'. If no message is printed and the script is still running, then xdebug isn't installed properly or uses different port or whatever else. So, kill the running process and investigate where the problem is, but this is the other story. 

Troubleshooting

* if something goes wrong then check your PHP Error Log that you can find after invoking WAMP context menu from system tray

* e,g,: WAMP icon -> PHP -> Error Log 

* Probably typo or file was not found if you see this:

* You downloaded wrong version of php.ini if you see following: 

* Do NOT use XAMPP 1.7.0. If you set up XDebug as described here, the Apache server crashes when you run or debug a file or project. The workaround prevents the IDE from stopping at breakpoints. XAMPP 1.7.1 is fine, with XDebug 2.0.4 VC 5.2 thread-safe.

* If you are trying to debug a Zend Framework project, make sure you set the Run Configuration - you can do this by selecting the 'properties' of the project.

* If you are having problems with 'Register Provider' then try updating to the latest Zend Framework. Latest known issues are regarded to version 1.10. You can either just download and unzip over the top of the old framework, or if it is in XAMP you can use pear to update. To update in PEAR use the commands: pear channel-discover pear.zfcampus.org, pear install zfcampus/zf. For windows users: make sure you start the command line instance with administrator priviledges and you starting directory should be //XAMPinstall/php/

 

* try to check Apache Error Log as well. Enable Xdebug logging

by adding into php.ini: xdebug.remote_log=/log_path/xdebug.log (see http://www.xdebug.org/docs/all_settings)the content of log is in /log_path/xdebug.log (this path is just an example, for Windows something like: C:... &&xdebug must be writable )Enable NetBeans PHP debugger logging

helpful is to turn on the debugger-related logging and attach the log into Issuezilla as well. See following simple steps:

* Running NetBeans with logging turned on. You can do this by:

* When NetBeans starts up, reproduce the bug, so it is logged into the log files.

* Then file a new issue (click this link) and attach (or just send me directly):

* Attach (or just send me directly) both log files xdebug.log and messages.logRemote Debuging 

* For Remote Web Server configuration Xdebug must be properly configured on remote server (not on local one)

* you need to have correctly configured property xdebug_remote.host on remote machine. The IP address of local machine has to be defined in this property. For example, you want to debug your source code on remote machine 192.168.0.1 using Netbeans installed on 192.168.0.2. You need to change xdebug.remote_host on 192.168.0.1 to xdebug.remote_host=192.168.0.2. If doesn't work verify you have port configured in xdebug.remote_port open on both machines.

* sometimes, Path Mapping must be usedUsing xdebug_file_link_format with NetBeans

In php.ini, the xdebug option xdebug.file_link_format opens the given file path in your editor of choice if it has a custom URL scheme. You can use this option with NetBeans but you have to customize your environment. A discussion of ways and means of using xdebug_file_link_format with NetBeans is available on The PHP Users Forum. Where to ask? 

* see PHP Users mailing listOther useful resources:

How to configure xdebug to work only on one virtual server ? - an online article on how to configure xdebug

Tutorial on how to configure Xdebug to work with phpDesigner 2008 - has screen shots.

FAQ

* what version of Xdebug should I download? 

First, you can try the app that XDebug developers provide for determining the version of XDebug to download! It's located at http://www.xdebug.org/find-binary.php. Paste the full output ofphpinfo() (either a copy & paste of the HTML versionor php -i output) into the form and submit it. The app returns tailoreddownload and installation instructions. Do not paste the raw HTML (fromview-source) into the form.

If this form does not work for you and you need to find the XDebug version manually, Xdebug has a simple rule for choosing a version of xdebug extension youneed to download: 'The Windows binaries generally work for every mini release for the mentioned PHP version, althoughthe extension is built against the most current PHP version at that time. The VCx marker tells with which compiler the extension was built, and Non-thread-safe whether ZTS was disabled. Those qualifiers need to match the PHP version you're using.'

You need to get answers on few simple questions, firstly1. whats your version of php? there are more ways to find this outeither

or create a file 

you should get output like below after running it in browser

Clearly my version of php is 5.2.6-3

2. Do I need Non Thread Safe or Thread Safe version? non-threaded use of PHP' for example the CLI, CGI or Apache 1.3 module threaded usage of PHP, for example the Apache 2 work MPM or the the ISAPI module

either run on Linux

or on Windows 

the other option is to have a look on phpinfo on 

or you can use command line Linux: 

Windows: 

My Thread Safety is apparently disabled so I don't need thread safe version. If you use Windows you most probably need thread safe version .

And that's it! Go to Xdebug download page and download appropriate file. I need veersion marked as 5.2. and NonThreadSafe.How to build Xdebug (useful for php5.3)Ubuntu

If you build your php5.3 from sources then the best way how to get stable xdebug to your Ubuntu is to build it. Well, building from sources can be tedious but building xdebug is pretty easy process. So, let's get started. I am using Karmic Koala release of Ubuntu. 

This process is well described on http://xdebug.org/docs/install as well.Get your xdebug sources

Download sources from http://xdebug.org/download.php. Xdebug 2.1.beta2 (or beta3 when you checkout sources) is current release that correctly works with php5.3.x (at the time being). Extract Xdebug sources 

if you downloaded .tgz then extract somewhereConfigure

Run 

then run xdebug configure script MakeCopy

I used /etc/php5/xdebug/ as copy destination. Set up your environment

configure php.ini 

and add xdebug.so path to the end of file. 

restart apache 

and have a look if phpinfo() output contains xdebug module. Troubleshooting

Please, refer to http://xdebug.org with xdebug installation, build process. You may want to see 'installation how to' on http://xdebug.org/docs/install in particular. Meet php version requirements

As written on xdebug web page, if configure script fails with something like:

then it means that you do not meet the PHP 4.3.x version requirement for Xdebug.Upgrade your autotools

If you get: Xdebug For Chrome

You will need to upgrade your autotools (autoconf, automake and libtool) or install the known working versions: autoconf-2.13, automake-1.5 and libtool-1.4.3.Xdebug Mac PhpstormRetrieved from 'http://wiki.netbeans.org/HowToConfigureXDebug'

 

 

 

 

broken image