Loading...

XDebug.HOST

Xdebug proxy service for debug your PHP code

  • XDebug.HOST proxy is a SaaS solution in Cloud.
  • Debug session flow looks like this:
  • PHP Server ⇆ XDebug.host proxy ⇆ IDE.
  • Supports both versions 2.x and 3.x of the xdebug extension.
  • Supports both IPv4 and IPv6. Server and IDE may have different IP versions.
  • e.g. Server (IPv4) ⇆ (IPv4) XDebug.host (IPv6) ⇆ (IPv6) IDE.

We are currently in beta testing. At this point, we offer you a free trial of our service with a limit of 3 IDE keys per account. The beta stage will last at least until March 01, 2025

Please feel free to send us feedback on any bugs or feature requests using the contact form

Prices

At the beta testing stage, prices are not final and may change

Beta

IDE keys: 3
Trial period: many days 😀

Price: FREE

Only for beta testing period
Sign up

Small

IDE keys: 3
Trial period: 7 days

Price: 5€

+ tax
(1.67€ key per month)

Medium

IDE keys: 10
Trial period: 7 days

Price: 15€

+ tax
(1.50€ key per month)

Large

IDE keys: 25
Trial period: 7 days

Price: 30€

+ tax
(1.20€ key per month)

Small

IDE keys: 3
Trial period: 7 days

Price: 50€

+ tax
(1.39€ key per month)

Medium

IDE keys: 10
Trial period: 7 days

Price: 150€

+ tax
(1.25€ key per month)

Large

IDE keys: 25
Trial period: 7 days

Price: 300€

+ tax
(1.00€ key per month)

A Xdebug Proxy is a tool designed to facilitate remote debugging with Xdebug in a situation where multiple developers need to connect to a single remote server for debugging purposes. It acts as an intermediary between the developers' IDEs (Integrated Development Environments) and the server where the PHP code is running.

Here's how it typically works:

  1. Multiple Debuggers Support

    In a standard setup without a proxy, Xdebug supports a single debugging connection at a time. However, in a team environment, multiple developers might need to debug simultaneously. A Xdebug Proxy allows for this by managing multiple debugging connections.

  2. Connection Routing

    Each developer connects to the Xdebug Proxy and registers their IDE key (a unique identifier). The proxy then routes debugging sessions from the server to the correct developer's IDE based on this key.

  3. Simplifies Network Configuration

    Without a proxy, each developer might need to configure their local environment and the server to enable remote debugging, which can be complex and time-consuming. The proxy simplifies this by being the single point of connection.

  4. Security

    It adds a layer of security, as the remote server does not need to be directly exposed to multiple clients for debugging purposes.

Overall, a Xdebug Proxy is particularly useful in complex development environments where multiple developers need to debug code on a remote server simultaneously. It streamlines the process and provides a more manageable and secure way of handling remote debugging sessions.

Xdebug is a popular debugging and profiling tool for PHP. It provides a range of features to improve the PHP development process, including:

  • Debugging

    Xdebug offers step-by-step code inspection, allowing developers to understand how their PHP code executes, which is especially helpful for finding bugs.

  • Stack Traces

    It enhances PHP's error display with stack traces, making it easier to trace the origin of errors and warnings.

  • Profiler

    Xdebug includes a profiler for PHP scripts, useful for identifying performance bottlenecks and optimizing code for better performance.

  • Code Coverage Analysis

    This feature is crucial for developers who perform test-driven development, as it shows which parts of the codebase are covered by tests.

  • Remote Debugging

    Xdebug can be configured for remote debugging, allowing developers to debug scripts running on a different server.

  • Breakpoints

    You can set breakpoints in your code, which will pause execution at that point, letting you examine the state of your application at that moment.

  • Variable Inspection

    During a debugging session, Xdebug allows you to inspect and modify variables.

  • Compatibility

    Xdebug integrates with many popular PHP development tools and IDEs, making it a versatile choice for various development setups

  • Configuration

    It is highly configurable, allowing developers to adjust its behavior according to their specific needs.

Overall, Xdebug is an essential tool for PHP developers looking to improve the quality of their code, diagnose issues more effectively, and optimize performance.

How to setup Xdebug extension on server

Xdebug is a powerful tool for PHP developers, offering debugging and profiling capabilities that significantly enhance the development process. Installing Xdebug can vary depending on your operating system. This article provides a comprehensive guide on how to install the Xdebug extension across different operating systems, including Windows, macOS, and Linux.

Prerequisites

Before proceeding with the installation, ensure you have:

  • PHP installed on your system. You can verify this by running php -v in your terminal or command prompt.
  • Access to terminal or command prompt.
  • Basic understanding of your operating system's command line interface.

Linux (Debian-based)

The process for Linux is similar to macOS, but package managers differ. For Debian-based systems (like Ubuntu), you would use apt; for Red Hat-based systems, yum or dnf might be used.

  • Install PHP: If PHP is not already installed, you can install it using your package manager. For Ubuntu/Debian:
  •                                                     
                                                            sudo apt-get update
                                                            sudo apt-get install php
                                                        
                                                    
  • Install Xdebug: Install Xdebug using the package manager:
  •                                                     
                                                            sudo apt-get install php-xdebug
                                                        
                                                    
  • Restart Your Web Server: Apply the changes by restarting your web server.
  • Verify Installation: Check if Xdebug is installed correctly by running php -v.

macOS

macOS users often use package managers like Homebrew for software installations. Here’s how to install Xdebug through Homebrew:

  • Install Homebrew: If you haven’t already, install Homebrew by running the following command in the terminal:
  •                                                     
                                                            /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
                                                        
                                                    
  • Install PHP and Xdebug: If PHP is not installed, you can install it along with Xdebug by running:
  •                                                     
                                                            brew install php
                                                            brew install xdebug
                                                        
                                                    
  • Restart Your Web Server: Restart your web server to apply the changes.
  • Verify Installation: Run php -v in the terminal to ensure Xdebug is installed.

Windows

  • Determine Your PHP Version: Open your command prompt and type php -v to find out your PHP version.
  • Download Xdebug: Visit the Xdebug download page and download the appropriate DLL file for your PHP version and architecture.
  • Edit php.ini: Locate your php.ini file, which is typically found in your PHP installation directory. Open it with a text editor and add the following line at the end. And replace "path\to\php_xdebug.dll" with the actual path to the DLL file you downloaded.
  •                                                     
                                                            zend_extension = "path\to\php_xdebug.dll"
                                                        
                                                    
  • Restart Your Web Server: Restart Apache, Nginx, or whichever web server you are using for the changes to take effect.
  • Verify Installation: Run php -v in your command prompt. If Xdebug is installed correctly, you should see it mentioned in the output.

Configure for using with XDebug.HOST service

After installing Xdebug, you need to configure it for using with XDebug.HOST. You can do this by adding specific Xdebug settings to your php.ini file on Windows and MacOS or /etc/php/<version>/mods-available/xdebug.ini on Debian-based systems.

  • For Xdebug v3
  •                                                     
                                                            xdebug.mode=debug
                                                            xdebug.discover_client_host = false
                                                            xdebug.client_host=xdebug.host
                                                            ;Optionally. Uncomment line below if you want restrict usage for certain IDE keys only.
                                                            ;xdebug.trigger_value=<YOUR_ACCOUNT_KEY>_alice,123ABC456MYACCOUNTKEY789QW_bob
                                                        
                                                    
  • For Xdebug v2
  •                                                     
                                                            xdebug.remote_enable=1
                                                            xdebug.remote_connect_back=0
                                                            xdebug.remote_handler=dbgp
                                                            xdebug.remote_mode=req
                                                            xdebug.remote_host=xdebug.host
                                                        
                                                    

Consult the Xdebug documentation for a comprehensive list of settings.

Installing Xdebug can significantly improve your PHP development workflow by providing valuable debugging information and performance metrics. By following the steps outlined for your specific operating system, you should now have Xdebug installed and ready to enhance your development process.

Setting up PhpStorm for use with XDebug.HOST

Integrating Xdebug with PhpStorm enhances debugging capabilities, making it easier to track down bugs and optimize performance. This updated guide reflects the PhpStorm interface changes, ensuring you can configure Xdebug proxy settings efficiently for remote debugging sessions.

Step 1: Configure PhpStorm to Use the Xdebug Proxy

  • Access PhpStorm Settings: Navigate to File > Settings on Windows/Linux, or PhpStorm > Settings... on macOS.
  • Find PHP Xdebug proxy Settings: Go to PHP > Debug > DBGp Proxy.
  • Set Up Xdebug Proxy:
    • Copy your IDE key from IDE keys management page and paste it to IDE key field.
    • Specify the Host: xdebug.host and Port: 9001.
  • PhpStorm Xdebug Proxy Settings screenshot
  • Apply Changes: Click OK to save your settings.

Step 2: Register IDE with Xdebug Proxy

Before PhpStorm can listen for connections from the Xdebug proxy, you need to register your IDE with the proxy server. This process tells the proxy your IDE key and where to forward incoming debugging connections.

Just navigate to main menu Tools > DBGp Proxy > Register IDE

Step 3: Start Listening for PHP Debug Connections

Activate listening for incoming debug connections by clicking on the Start Listening for PHP Debug Connections icon in toolbar.

PhpStorm xdebug connection listening button PhpStorm xdebug connection listening button

Step 4: Debugging with PhpStorm

With the configuration complete, you're ready to debug:

  • Set Breakpoints: Click next to the line numbers in your PHP code where you want execution to pause.
  • Initiate Debug Session by trigger your PHP script. This usually means accessing a specific URL with trigger value in Cookies or query string. You can use Web browser extension to simplify toggling trigger:
  • Use Debugger Features: Once a breakpoint is hit, use PhpStorm's debugging tools to step through code, inspect variables, and evaluate expressions.

Conclusion

Registering your IDE with the Xdebug proxy server is a critical step for remote debugging, ensuring that the proxy correctly routes debugging information to PhpStorm. By following these instructions, including the registration process, you can set up a robust remote debugging environment that leverages the power of Xdebug with PhpStorm, enhancing your development efficiency and problem-solving capabilities.

Setting up VS Code for use with XDebug.HOST

Visual Studio Code (VS Code) is a lightweight but powerful source code editor that runs on your desktop. It comes with built-in support for JavaScript, TypeScript, and Node.js, and has a rich ecosystem of extensions for other languages, including PHP. When combined with Xdebug, it provides a robust environment for debugging PHP applications. This guide will walk you through setting up VS Code to use Xdebug through a proxy, which is especially useful for remote debugging or working in environments where direct connection to Xdebug is not possible.

Step 1: Install PHP Debug Extension

  • Open VS Code.
  • Go to the Extensions view by clicking on the square icon on the sidebar or pressing Ctrl+Shift+X (Cmd+Shift+X on MacOS).
  • Search for "PHP Debug" by Xdebug (xdebug.org) and install it.

Step 2: Configure VS Code for Xdebug.HOST

  • Create a PHP Debug Configuration: Go to the Run view by clicking on the play icon on the sidebar or pressing Ctrl+Shift+D (Cmd+Shift+D on MacOS). Click on "create a launch.json file", then select PHP. This creates a launch.json file in the .vscode folder of your workspace.
  • Edit launch.json for Proxy Settings: Add or modify the configurations to include the pathMappings and port, according to your server setup. Here’s an example configuration:
  •                                                     
                                                            {
                                                              "version": "0.2.0",
                                                              "configurations": [
                                                                {
                                                                  "name": "Listen for XDebug.HOST",
                                                                  "type": "php",
                                                                  "request": "launch",
                                                                  "port": 9003,
                                                                  "pathMappings": {
                                                                    "/var/www/html": "${workspaceFolder}/src",
                                                                    "/app": "${workspaceFolder}"
                                                                  },
                                                                  "proxy": {
                                                                    "enable": true,
                                                                    "host": "xdebug.host",
                                                                    "port": 9001,
                                                                    "key": "123ABC456MYACCOUNTKEY789QW_alice"
                                                                  }
                                                                }
                                                              ]
                                                            }
                                                        
                                                    
  • Adjust pathMappings to match your server and local paths.

Step 4: Start Debugging

  • Start Listening: In VS Code, go to the Run view, select "Listen for XDebug.HOST" from the dropdown, and click the green play button. This tells VS Code to start listening for incoming Xdebug connections and register your IDE on XDebug.HOST.
  • Trigger Debugging: Trigger an Xdebug session from your application. This can be done by accessing a web page or running a script that initiates an Xdebug session with the correct IDE key.
  • Interact with Debugger: Once connected, you can use VS Code's debugging tools to step through code, inspect variables, and evaluate expressions.

Conclusion

Setting up Visual Studio Code for use with an Xdebug proxy involves configuring both Xdebug to communicate through the proxy and VS Code to listen for connections from the proxy. This setup is invaluable for remote debugging or environments where direct connections to Xdebug are not feasible. By following these steps, you can leverage the powerful debugging features of Xdebug within the versatile and user-friendly VS Code editor, enhancing your PHP development workflow.