- Configure Xdebug
- Download Xdebug
- Integrate Xdebug with the PHP interpreter
- Configure Xdebug in IntelliJ IDEA
- Check Xdebug installation
- Define Xdebug behaviour
- Configure Xdebug for using in the On-Demand mode
- Configure Xdebug for using in the Just-In-Time mode
- Command-line scripts
- Web server debugging
- Configure Xdebug running in a Docker container
- Configure Xdebug running on a Vagrant instance
- Saved searches
- Use saved searches to filter your results more quickly
- Debugger not installed #381
- Debugger not installed #381
- Comments
Configure Xdebug
This functionality relies on the PHP plugin, which you need to install and enable.
The PHP plugin is available only in IntelliJ IDEA Ultimate.
- Press Control+Alt+S to open the IDE settings and then select Plugins .
- Open the Marketplace tab, find the PHP plugin, and click Install (restart the IDE if prompted).
Download Xdebug
- Download the Xdebug extension compatible with your PHP version and install it as described in the Xdebug 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 a preconfigured AMP (Apache, MySQL, PHP) 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 dialog ( Control+Alt+S ), click PHP under Languages & Frameworks .
- On the PHP reference 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 .
zend_extension= zend_extension=
[xdebug] zend_extension=»» xdebug.mode=debug xdebug.client_host=127.0.0.1 xdebug.client_port=»» [xdebug] zend_extension=»» xdebug.remote_enable=1 xdebug.remote_host=127.0.0.1 xdebug.remote_port=»» The output should list Xdebug among the installed extensions:
Create a php file containing the following code:Configure Xdebug in IntelliJ IDEA
Check Xdebug installation
- Press Control+Alt+S to open the IDE settings and then 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 IntelliJ IDEA, see Configuring local PHP interpreters and Configuring 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, IntelliJ IDEA shows the corresponding message:
Alternatively, open the Installation Wizard, 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 Xdebug behaviour
- In the IDE settings ( Control+Alt+S ), select Debug under the PHP node to open the Debug page.
- In the Xdebug area, specify the following settings:
- Debug port : appoint the port through which the tool will communicate with IntelliJ IDEA. This must be the same port number as specified in the php.ini file:
- Ignore external connections through unregistered server configurations : select this checkbox to have IntelliJ IDEA ignore connections received from hosts and through ports that are not registered as deployment server configurations. When this checkbox is selected, IntelliJ IDEA 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 IntelliJ IDEA 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, IntelliJ IDEA only listens for incoming IPv4 connections. To enable IPv6 support, you need to make adjustments in IntelliJ IDEA 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 IntelliJ IDEA.
Configure Xdebug for using in the On-Demand mode
IntelliJ IDEA 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.
- Open the CLI Interpreters dialog and click next to the PHP executable field. IntelliJ IDEA informs you that debugger is not installed:
- To enable IntelliJ IDEA 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
IntelliJ IDEA 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 IntelliJ IDEA 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:
- Xdebug 2 uses the xdebug .remote_mode setting, which has to be set to jit .
- Xdebug 3 uses the xdebug.start_upon_error setting, which has to be set to yes .
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 (for Xdebug 2) or -dxdebug.start_upon_error=yes (for Xdebug 3) directive as an additional configuration option :
- Press Control+Alt+S to open the IDE settings and then select 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.
Web server debugging
- Make sure that the debugging engine on your local or remote web server is properly configured. For details, see Validate the configuration of a debugging engine.
- Open the php.ini file which is reported as loaded and associated with Xdebug.
- In the php.ini file, find the [xdebug] section.
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.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 mode and client_host Xdebug parameters.
Note that the xdebug.client_host value should be replaced with the IP address of the machine where IntelliJ IDEA is running, which is accessible from the Docker container. If you are using Docker for Windows or Docker for Mac, you can set xdebug.client_host to host.docker.internal , 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.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 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 IntelliJ IDEA 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=»Note that the xdebug.client_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 IntelliJ IDEA is running.
[xdebug] zend_extension=»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 IntelliJ IDEA is running.
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugger not installed #381
Debugger not installed #381
Comments
In PHPStorm setting of remote interpreter, I can see that Debugger not installed like here:
However, in docker-compose.yml, I have INSTALL_XDEBUG=true as:
workspace: build: context: ./workspace args: - INSTALL_XDEBUG=true - INSTALL_MONGO=false - INSTALL_NODE=false - INSTALL_DRUSH=false - COMPOSER_GLOBAL_INSTALL=false - INSTALL_WORKSPACE_SSH=true - PUID=1000 - PGID=1000 volumes_from: - volumes_source extra_hosts: # IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts) - "docker host:172.17.0.1 ports: - "223:22" tty: true ### PHP-FPM Container ####################################### php-fpm: build: context: ./php-fpm args: - INSTALL_XDEBUG=true - INSTALL_MONGO=false - INSTALL_ZIP_ARCHIVE=false - INSTALL_MEMCACHED=false - INSTALL_OPCACHE=false dockerfile: Dockerfile-70 volumes_from: - volumes_source expose: - "9000" links: - workspace extra_hosts: # IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts) - "docker host:172.17.0.1 environment: # IMPORTANT: Set the Remote Interpreter entry matching name to `larval`" - PHP_IDE_CONFIG="serverName=laravel"
The text was updated successfully, but these errors were encountered: