Download xdebug

Download xdebug DEFAULT

Configure Xdebug

Download Xdebug

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

    Xdebug 3 brings performance improvements, simplified configuration, and PHP 8 support. To learn more on upgrading to Xdebug 3, see the Upgrade 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

  1. Open the active php.ini file in the editor:

    1. In the Settings/Preferences dialog , click PHP.

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

    3. 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.

  2. 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>

  3. To enable Xdebug, locate or create the section in the php.ini file and update it as follows:

    [xdebug] zend_extension="<path to xdebug extension>" xdebug.remote_enable=1 xdebug.remote_host=127.0.0.1 xdebug.remote_port="<the port (9000 by default) to which Xdebug connects>"

    [xdebug] zend_extension="<path to xdebug extension>" xdebug.mode=debug xdebug.client_host=127.0.0.1 xdebug.client_port="<the port (9003 by default) to which Xdebug connects>"

    In PHP 5.3 and later, you need to use only , not , , or .

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

  4. Save and close the php.ini file.

  5. Verify Xdebug installation by doing any of the following:

    • In the command line, run the following command:

      php --version

      The output should list Xdebug among the installed extensions:

      Xdebug extension installed
    • Create a php file containing the following code:

      <?php phpinfo();

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

      Xdebug support enabled

Configure Xdebug in PhpStorm

  1. Press to open the IDE settings and select PHP.
  2. Check the Xdebug installation associated with the selected PHP interpreter:

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

    2. 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:

        ps_interpreters_debugger_not_installed.png

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

  3. 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 the same port number as specified in the php.ini file:

      xdebug.remote_port="<the port (9000 by default) to which Xdebug connects>"

      xdebug.client_port="<the port (9003 by default) to which Xdebug connects>"

      By default, Xdebug 2 listens on port 9000. For Xdebug 3, the default port has changed from 9000 to 9003. You can specify several ports by separating them with a comma. By default, the Debug port value is set to 9001,9003 to have PhpStorm listen on both ports simultaneously.

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

    • Select the Force break at first line when no path mapping 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 first line when a 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.

  4. 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 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:

  1. Select from the main menu.

  2. In the .vmoptions file that opens, delete the line.

  3. Restart PhpStorm.

Configure Xdebug for using in the On-Demand mode

PhpStorm 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.

  1. Disable Xdebug for command-line scripts:

    1. In the Settings/Preferences dialog , go to PHP.

    2. From the PHP executable list, choose the relevant PHP interpreter and click the Browse button 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.

    3. In the php.ini file, find the section and comment the following line in it by adding in preposition:

      ;[xdebug] ;zend_extension = "<path to xdebug extension>"

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

      ps_interpreters_debugger_not_installed.png
  2. 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 the Browse button 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. Depending on the Xdebug version used, this operation mode is toggled through the following settings:

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 (for Xdebug 2) or (for Xdebug 3) directive as an additional configuration option:

  1. Press to open the IDE settings and select PHP.
  2. From the PHP executable list, choose the relevant PHP interpreter and click the Browse button next to it.

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

  4. In the Configuration Options dialog that opens, click the Add button to add a new entry.

    • For Xdebug 2, type in the Configuration directive field and in the Value field.

    • For Xdebug 3, type in the Configuration directive field and in the Value field.

    When you click OK, you return to the CLI Interpreters dialog where the Configuration options field shows (for Xdebug 2) or (for Xdebug 3).

Web server debugging

  1. From the main menu, choose .

  2. 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 Browsethe Browse button in the Deployment dialog.

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

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

  5. In the php.ini file, find the section.

    Change the value of the from the default to .

    Change the value of the from the default to .

See also Just-In-Time debugging and PHP Exception Breakpoints with PhpStorm and Xdebug

Configure Xdebug running in a Docker container

To configure Xdebug running in a Docker container, provide the Xdebug-specific parameters in the Dockerfile, for example:

RUN pecl install xdebug \ && docker-php-ext-enable xdebug && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_host = host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \

In this example, we're modifying /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini providing the and Xdebug parameters.

Note that the 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 to , which automatically resolves to the internal address of the host, letting you easily connect to it from the container.

RUN pecl install xdebug \ && docker-php-ext-enable xdebug && echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.client_host = host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \

In this example, we're modifying /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini providing the and Xdebug parameters.

Note that the 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 to , 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 value is . This is the gateway used in the default Vagrant setup, which allows connecting from the instance to host where PhpStorm is running.

[xdebug] zend_extension="<path to xdebug extension>" xdebug.mode=debug xdebug.client_host=10.0.2.2 xdebug.client_port=9003

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

Last modified: 19 May 2021

Configure a debugging engineConfigure Zend Debugger

Sours: https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html

odan/xampp_php7_xdebug.md

Requirements

Setup

If the file already exists, you can skip the download.

[XDebug]zend_extension = "c:\xampp\php\ext\php_xdebug.dll";zend_extension = "c:\xampp\php\ext\php_xdebug-2.9.7-7.4-vc15-x86_64.dll"xdebug.remote_autostart = 1 xdebug.profiler_append = 0 xdebug.profiler_enable = 0 xdebug.profiler_enable_trigger = 0 xdebug.profiler_output_dir = "c:\xampp\tmp";xdebug.profiler_output_name = "cachegrind.out.%t-%s"xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp"xdebug.remote_host = "127.0.0.1"xdebug.remote_log = "c:\xampp\tmp\xdebug.txt"xdebug.remote_port = 9000 xdebug.trace_output_dir = "c:\xampp\tmp";36000 = 10hxdebug.remote_cookie_expire_time = 36000
  • Restart Apache

  • Click the Github ★ Star button :-)

PhpStorm

Netbeans

Visual Studio Code

Adobe Brackets

Sublime Text 2 and 3

Start debugger from the console

Enter cmd:

Postman

Add as query parameter to the url, e.g.

Follow me on Twitter | Blog

Sours: https://gist.github.com/odan/1abe76d373a9cbb15bed
  1. House for sale bonner
  2. Vintage metal fruit bowl
  3. Parker hydraulic
  4. Toyota prius phoenix

Installing Xdebug

This topic describes how to install Xdebug either on Zend Studio PHP executables or a local PHP Web server.

Note:

Xdebug cannot be used with PHP 5.5 executable (CLI and CGI) on Windows and Mac.

Installing Xdebug on a Zend Studio PHP Executable

This procedure describes how to install Xdebug on a Zend Studio PHP Executable. If you want to use Xdebug for debugging on a Web server, you will need to install Xdebug on your Web server as well. See Installing Xdebug on a PHP Web Server below for more details.

 

 

Instructions on how to complete a procedure

To install Xdebug:

  1. Download Xdebug from Xdebug Downloads page. To find out which version of the extension to download, click here.
  2. Disable the Zend Debugger:
    1. Open the 'php.ini' file of your PHP:

    <Zend_Studio_install_dir>\plugins\com.zend.php.debug.debugger.win32.x86_10.6.0.v20140121-1240\resources\php.ini

    1. Add a semi-colon ';' before "zend_extension=..." as follows:

    ;zend_extension="C:\Program Files (x86)\Zend\Zend Studio 10.6.0\plugins\com.zend.php.debug.debugger.win32.x86_10.6.0.v20140123-1837\resources\php53\ZendDebugger.dll"

  1. Move the downloaded file to your Zend Studio's installation files:

<Zend_Studio_install_dir>\plugins\com.zend.php.debug.debugger.win32.x86_10.6.0.v20140121-1240\resources\php_version

  1. Back in the 'php.ini' file, add the path to the Xdebug extension.

For example:

Linux and Mac OS: zend_extension="/usr/local/php/modules/xdebug.so"

Windows: zend_extension="<path to .dll file>"

  1. Add the following line:

xdebug.remote_enable=true

  1. Save your changes, and restart your Web server.

Note:

To verify that Xdebug was installed correctly, call the “php --re xdebug” command. If the output is different than 'Exception: Extension xdebug does not exist', the extension is installed correctly.

Once installed, you can now configure Xdebug in Zend Studio to begin debugging.

Installing Xdebug on a PHP Web Server

This procedure describes how to install Xdebug on a PHP Web server.

 

 

Instructions on how to complete a procedure

To install Xdebug:

  1. Download Xdebug from Xdebug Downloads page. To find out which version of the extension to download, click here.
  2. If you are using Zend Server, disable the Zend Debugger (If not, skip to step 3).
    1. Access the Zend Server UI (http://<server_ip>:10081/ZendServer).
    2. Go to the Configurations | Components page.
    3. Select the Zend Debugger from the components list, and click Disable in the Action bar.
    4. Restart Zend Server.

  3. Move the downloaded file to your Web server's installation files.

If you are using Zend Server:

<Zend_Server_install_dir>\lib\phpext

  1. Open your Web server's 'php.ini' file.

If you are using Zend Server:

<Zend_Server_install_dir>\etc\php.ini

  1. Back in the 'php.ini' file, add the path to the Xdebug extension.
    For example:

Linux and Mac OS: zend_extension="/usr/local/php/modules/xdebug.so"

Windows: zend_extension="<path to .dll file>"

  1. Add the following line:

xdebug.remote_enable=true

  1. Save your changes, and restart your Web server.

Note:

To verify that Xdebug was installed correctly, call the “php --re xdebug” command. If the output is different than 'Exception: Extension xdebug does not exist', the extension is installed correctly.

Once installed, you can now configure Xdebug in Zend Studio to begin debugging.

Sours: https://help.zend.com/zendstudio/current/content/installing_xdebug.htm
HOW TO INSTALL XDEBUG IN 2 MINUTES - SUPER CODE 2020

Xdebug is an extension for PHP, and provides a range of features to improve the PHP development experience.

Step Debugging
A way to step through your code in your IDE or editor while the script is executing.
Improvements to PHP's error reporting
An improved function, stack traces for Notices, Warnings, Errors and Exceptions to highlight the code path to the error
Tracing
Writes every function call, with arguments and invocation location to disk. Optionally also includes every variable assignment and return value for each function.
Profiling
Allows you, with the help of visualisation tools, to analyse the performance of your PHP application and find bottlenecks.
Code Coverage Analysis
To show which parts of your code base are executed when running unit tests with PHP Unit.

Xdebug is made possible through the generous support of Xdebug's business-tier sponsors:

You can also be listed as a supporter by signing up for a Business package.

Sours: https://xdebug.org/

Xdebug download

Installation

This section describes on how to install Xdebug.

How you install Xdebug depends on your system. There are the following possibilities:

Installing on Linux #

Installing Xdebug with a package manager is often the fastest way. Depending on your distribution, run the following command:

  • Alpinelinux:
  • Arch Linux:
  • CentOS:
  • CentOS (Remi Repro):
  • Debian (9/stretch, testing/buster/bullseye/sid):
  • Fedora (32):
  • Fedora (Remi Repro):
  • Gentoo:
  • Manjaro (20.1/Mikah):
  • RHEL:
  • RHEL (Remi Repro):
  • SUSE (openSUSE, Enterprise):
  • Ubuntu (18.04 LTS/Bionic, 20.04 LTS/Focal):
  • Ubuntu (Ondřej Surý's PPA):

Xdebug's latest version is 3.1.1.

For packages that have the PHP version in the package name, such as in , you can substitute the PHP version with the one that matches the PHP version that you are running.

Linux distributions might be providing an old and/or outdated version. If the package manager installs a version that is no longer supported (see Supported Versions), please install Xdebug with PECL, or from source instead.

Installing with PECL #

You can install Xdebug through PECL on Linux & macOS with Homebrew. Run:

pecl install xdebug

On Apple M1 hardware, you might instead need to use:

arch -x86_64 sudo pecl install xdebug

You should ignore any prompts to add to — this will cause problems.

In some cases will change the file to add a configuration line to load Xdebug. You can check whether it did by running . If Xdebug shows up with a version number, than you're all set and you can configure Xdebug's other functions, such as Step Debugging, or Profiling.

If did not add the right line, skip to the Configure PHP section.

Installing on Windows #

There are a few precompiled modules for Windows, they are all for the non-debug version of PHP. You can get those at the download page. Follow these instructions to get Xdebug installed.

Installation From Source #

Obtain #

You can download the source of the latest stable release 3.1.1.

Alternatively you can obtain Xdebug from GIT:

git clone git://github.com/xdebug/xdebug.git

This will checkout the latest development version which is currently 3.2.0dev. This development branch might not always work as expected, and may have bugs.

You can also browse the source on GitHub at https://github.com/xdebug/xdebug.

Compile #

There is a wizard available that provides you with the correct file to download, and which paths to use.

You compile Xdebug separately from the rest of PHP. You need access to the scripts and . If your system does not have and , you will need to install the PHP development headers.

Debian users can do that with:

apt-get install php-dev

And RedHat and Fedora users with:

yum install php-devel

It is important that the source version matches the installed version as there are slight, but important, differences between PHP versions. Once you have access to and , take the following steps:

  1. Unpack the tarball:

    You should not unpack the tarball inside the PHP source code tree. Xdebug is compiled separately, all by itself, as stated above.

  2. If phpize is not in your path, please make sure that it is by expanding the environment variable. Make sure you use the phpize that belongs to the PHP version that you want to use Xdebug with. See this FAQ entry if you're having some issues with finding which phpize to use.

Configure PHP #

  1. Find out which PHP ini file to modify.

    Run a script with the following to find all configuration files that PHP has loaded:

    <?php var_dump(php_ini_loaded_file(), php_ini_scanned_files());

    Alternatively, you can run on the command line.

    If there is a file with in the name, such as , then this is the file to use.

    If that file does not exist, but there are other files in a or similar directory, you can create a new file there too. Please name it in that case.

    Otherwise, modify the file that is displayed through the script, or command.

    There could be more than one file. In many set-ups there is a different one for the command line (often ) and the web server (often ).

    If you want to use Xdebug and OPCache together, you must have the line for Xdebug below the line for OPCache, or in a file starting with a higher number (ie. vs ), otherwise they won't work properly together.

  2. Add the following line to this PHP ini file:

  3. Restart your webserver, or PHP-FPM, depending on what you are using.

  4. Verify that Xdebug is now loaded.

    Create a PHP page that calls xdebug_info(). If you request the page through the browser, it should show you an overview of Xdebug's settings and log messages.

    On the command line, you can also run . Xdebug and its version number should be present as in:

    PHP 7.4.10 (cli) (built: Aug 18 2020 09:37:14) ( NTS DEBUG ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.10-dev, Copyright (c), by Zend Technologies with Xdebug v3.0.0-dev, Copyright (c) 2002-2020, by Derick Rethans

    If Xdebug does not show up, or you get a warning from PHP that an file or similar was not found, you might need to use the full path instead of just , such as .

    On Windows, you should place the in the directory, which is a child directory in your PHP installation tree.

If you have trouble with this, please refer to the installation wizard to help you guide through this process.

With Xdebug loaded, you can now enable individual features, such as Step Debugging, or Profiling.

Related Content #

  • Xdebug 3: Diagnostics

    This video teaches you how to troubleshoot your Xdebug setup. It explains how to find out how Xdebug is configured, which settings have been made, and what it is attempting to do regarding its different features.

  • Xdebug 3: Modes

    This video introduces Xdebug 3's modes — the new way to configure which parts of Xdebug you have enabled.

Related Settings and Functions #

Settings #


string xdebug.log = #

Configures Xdebug's log file.

Xdebug will log to this file all file creations issues, Step Debugging connection attempts, failures, and debug communication.

Enable this functionality by setting the value to a absolute path. Make sure that the system user that PHP runs at (such as if you are running with Apache) can create and write to the file.

The file is opened in append-mode, and will therefore not be overwritten by default. There is no concurrency protection available.

The log file will include any attempt that Xdebug makes to connect to an IDE:

[2693358] Log opened at 2020-09-02 07:19:09.616195 [2693358] [Step Debug] INFO: Connecting to configured address/port: localhost:9003. [2693358] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-( [2693358] [Profiler] ERR: File '/foo/cachegrind.out.2693358' could not be opened. [2693358] [Profiler] WARN: /foo: No such file or directory [2693358] [Tracing] ERR: File '/foo/trace.1485761369' could not be opened. [2693358] [Tracing] WARN: /foo: No such file or directory [2693358] Log closed at 2020-09-02 07:19:09.617510

It includes the opening time (), the IP/Hostname and port Xdebug is trying to connect to (), and whether it succeeded (). The number in brackets () is the Process ID.

It includes:

process ID in brackets
opening time

For Step Debugging:

INFO: Connecting to configured address/port: localhost:9003. ERR: Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(

For Profiling:

ERR: File '/foo/cachegrind.out.2693358' could not be opened. WARN: /foo: No such file or directory

For Function Trace:

ERR: File '/foo/trace.1485761369' could not be opened. WARN: /foo: No such file or directory

All warnings and errors are described on the Description of errors page, with detailed instructions on how to resolve the problem, if possible. All errors are always logged through PHP's internal logging mechanism (configured with error_log in ). All warnings and errors also show up in the diagnostics log that you can view by calling xdebug_info().

Step Debugger Communication

The debugging log can also log the communication between Xdebug and an IDE. This communication is in XML, and starts with the XML element:

<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///home/httpd/www.xdebug.org/html/router.php" language="PHP" xdebug:language_version="7.4.11-dev" protocol_version="1.0" appid="2693358" idekey="XDEBUG_ECLIPSE"> <engine version="3.0.0-dev"><![CDATA[Xdebug]]></engine> <author><![CDATA[Derick Rethans]]></author> <url><![CDATA[https://xdebug.org]]></url> <copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright> </init>

The attribute lists the entry point of your application, which can be useful to compare to commands to see if path mappings are set-up correctly.

Beyond the element, you will find the configuration of features:

<- feature_set -i 4 -n extended_properties -v 1 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="extended_properties" success="1"> </response>

And continuation commands:

<- step_into -i 9 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="9" status="break" reason="ok"> <xdebug:message filename="file:///home/httpd/www.xdebug.org/html/router.php" lineno="3"> </xdebug:message> </response>

You can read about DBGP - A common debugger protocol specification at its dedicated documation page.

The xdebug.log_level setting controls how much information is logged.

Many Linux distributions now use systemd, which implements private tmp directories. This means that when PHP is run through a web server or as PHP-FPM, the directory is prefixed with something akin to:

/tmp/systemd-private-ea3cfa882b4e478993e1994033fc5feb-apache.service-FfWZRg

This setting can additionally be configured through the environment variable.


integer xdebug.log_level = 7#

Configures which logging messages should be added to the log file.

The log file is configured with the xdebug.log setting.

The following levels are supported:

LevelNameExample
0CriticalsErrors in the configuration
1ErrorsConnection errors
3WarningsConnection warnings
5CommunicationProtocol messages
7InformationInformation while connecting
10DebugBreakpoint resolving information

Criticals, errors, and warnings always show up in the diagnostics log that you can view by calling xdebug_info().

Criticals and errors are additionally logged through PHP's internal logging mechanism (configured with error_log in ).

This setting can additionally be configured through the environment variable.


string xdebug.mode = develop#

This setting controls which Xdebug features are enabled.

This setting can only be set in or files like that are read when a PHP process starts (directly, or through php-fpm), but not in and files, which are read per-request.

The following values are accepted:

Nothing is enabled. Xdebug does no work besides checking whether functionality is enabled. Use this setting if you want close to 0 overhead.
Enables Development Helpers including the overloaded var_dump().
Enables Code Coverage Analysis to generate code coverage reports, mainly in combination with PHPUnit.
Enables Step Debugging. This can be used to step through your code while it is running, and analyse values of variables.
Enables Garbage Collection Statistics to collect statistics about PHP's Garbage Collection Mechanism.
Enables Profiling, with which you can analyse performance bottlenecks with tools like KCacheGrind.
Enables the Function Trace feature, which allows you record every function call, including arguments, variable assignment, and return value that is made during a request to a file.

You can enable multiple modes at the same time by comma separating their identifiers as value to xdebug.mode: .

XDEBUG_MODE environment variable

You can also set Xdebug's mode by setting the environment variable on the command-line; this will take precedence over the xdebug.mode setting, but will not change the value of the xdebug.mode setting.

Some web servers have a configuration option to prevent environment variables from being propagated to PHP and Xdebug.

For example, PHP-FPM has a configuration setting that is by default, which you will need to turn if you want to use .

Make sure that your web server does not clean the environment, or specifically allows the environment variable to be passed on.

Functions #


xdebug_info( string $category = null ) : mixed#

Show and retrieve diagnostic information

This function presents APIs to retrieve information about Xdebug itself. Which information gets returned, or displayed, depends on which arguments, or none at all, are given.

=

Without arguments, this function returns an HTML page which shows diagnostic information. It is analogous to PHP's phpinfo() function.

The HTML output includes which mode is active, what the settings are, and diagnostic information in case there are problems with debugging connections, opening of files, etc.

Each warning and error in the diagnostics log also links through to the Description of errors documentation page.

= (New in Xdebug 3.1)

The function returns an array of all the enabled modes, whether through xdebug.mode or the environment variable.

Example:

Returns:

array(3) { [0] => string(5) "debug" [1] => string(7) "develop" [2] => string(5) "trace" }

= (New in Xdebug 3.1)

The function returns an array of all the compile flags that were enabled when running as part of Xdebug's compilation process.

The only flag that is available, is the flag. If this flag is enabled, then the xdebug.use_compression setting is available, and enabled by default.

Profiling and Function Trace will create GZip compressed files if the xdebug.use_compression setting is turned on (the default).

Example:

Returns:

array(1) { [0] => string(11) "compression" }
Sours: https://xdebug.org/docs/install
🆕 PHP Xdebug vscode - php debugging Video

.

Now discussing:

.



718 719 720 721 722