Poll success but error operation now in progress 29

Ответили на вопрос 2 человека. Оцените лучшие ответы! И подпишитесь на вопрос, чтобы узнавать о появлении новых ответов.

DrDragoN

Здравствуйте!

Проблема состоит в следующем, что PHPStorm не может соединиться с xdebug. В лог падают ошибки:

I: Checking remote connect back address.
I: Checking header ‘HTTP_X_FORWARDED_FOR’.
I: Checking header ‘REMOTE_ADDR’.
I: Remote address found, connecting to xx.xx.xx.xx:9001.
W: Creating socket for ‘xx.xx.xx.xx:9001’, poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(


  • Вопрос задан

    более трёх лет назад

  • 1769 просмотров

Пригласить эксперта

Привет, если работаешь в Ubuntu то сделай так

sudo apt-get install php5-xdebug -y

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

zend_extension=xdebug.so

xdebug.default_enable=1
xdebug.var_display_max_depth=6
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_log=/tmp/xdebug.log
xdebug.idekey="PHPSTORM"
xdebug.profiler_enable_trigger=1
xdebug.profiler_enable=0
xdebug.profiler_output_dir=/tmp/profiler
xdebug.show_local_vars=1
xdebug.overload_var_dump=1


  • Показать ещё
    Загружается…

10 февр. 2023, в 02:20

3000 руб./за проект

10 февр. 2023, в 01:33

1500 руб./за проект

10 февр. 2023, в 00:54

2000 руб./в час

Минуточку внимания

This section provides the list of solutions and workarounds for common problems with Debugging in PhpStorm.

Collecting PhpStorm debugging logs

If your issue is not addressed in this section, contact our support engineers. If asked to provide deployment logs, follow the instructions to collect them.

Collect debugging logs

  1. Select in the main menu.

  2. In the Custom Debug Log Configuration dialog that opens, add the following lines depending on the issues you are experiencing:

    • Issues with PHP debugging: #com.jetbrains.php.debug

    Collect logs

  3. Click OK and reproduce the issue.

  4. Locate the log file by selecting (for Windows and Linux) or (for macOS).

    If necessary, you can locate the log manually:

    Syntax

    %HOMEPATH%.<product><version>systemlog

    Example

    C:UsersJohnS.PhpStorm2022.3systemlog

    Syntax

    ~/Library/Logs/<product><version>

    Example

    ~/Library/Logs/PhpStorm2022.3

    Syntax

    ~/.<product><version>/system/log

    Example

    ~/.PhpStorm2022.3/system/log

    The most recent log file is named idea.log; older files names end with a number, that is idea.log.1, idea.log.2, and so on. In most cases you need only the most recent one.

  5. Attach the log file(s) to the issue or forum thread.

Collecting Xdebug logs

When using Xdebug, it is possible to make it log its actions.

  1. In the Settings dialog (Ctrl+Alt+S), 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, enable Xdebug logging by adding the following line:

    xdebug.log=»path_to_log/xdebug.log»

    xdebug.remote_log=»path_to_log/xdebug.log»

    The log file contains the raw communication between PhpStorm and Xdebug as well as any warnings or errors:

    Log opened at 2018-01-08 08:14:28 I: Connecting to configured address/port: 127.0.0.1:9000. I:
    Connected to client. :-) -> <init xmlns=»urn:debugger_protocol_v1″
    xmlns:xdebug=»https://xdebug.org/dbgp/xdebug»
    fileuri=»file:///C:/Projects/Samples/DebuggingTutorial/debugging.php» language=»PHP»
    protocol_version=»1.0″ appid=»3040″ idekey=»11774″><engine version=»2.2.5″><![CDATA[Xdebug]]></engine><author><![CDATA[Derick
    Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright
    (c) 2002-2018 by Derick Rethans]]></copyright></init>

    <- step_into -i 5 -> <response xmlns=»urn:debugger_protocol_v1″
    xmlns:xdebug=»https://xdebug.org/dbgp/xdebug» command=»step_into» transaction_id=»5″ status=»break»
    reason=»ok»>< xdebug:message
    filename=»file:///C:/Projects/Samples/DebuggingTutorial/debugging.php» lineno=»2″></xdebug:message></response>

Making sure Xdebug or Zend Debugger are installed and configured

To debug PHP code with PhpStorm, make sure that you have a debugging engine, either Xdebug or Zend Debugger, installed and configured properly.

These tools cannot be used simultaneously because they block each other. To avoid this problem, you need to update the corresponding sections in the php.ini file as described in Configure Xdebug and Configure Zend Debugger.

To validate the debugging engine configuration, perform the steps described in Validate the Configuration of a Debugging Engine

Startup warnings and errors preventing the debugger from working

When running PHP, it can happen that a startup warning or error is displayed. When this is the case, the debugger may fail to work. PhpStorm will also not be able to recognize the debugger being used.

To verify that no startup warnings or errors are displayed, run the following command:

php —version

This will return a message similar to the following:

<some error/warning> PHP 7.1.20 (cli) (built: Jul 20 2018 10:27:12) ( NTS ) Copyright (c) 1997-2018
The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.1.20,
Copyright (c) 1999-2018, by Zend Technologies with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

If any errors or warnings are present on the first lines, it’s recommended to fix them before continuing.

Debugger cannot connect

When the debugger cannot connect or refuses the connection, check the following:

  • Make sure Xdebug or Zend Debugger are configured to connect to the host and port PhpStorm is running on.

    • In the Xdebug configuration, make sure xdebug.remote_host and xdebug.remote_port (xdebug.client_host and xdebug.client_port for Xdebug 3) are correct. Refer to the Xdebug documentation for details.

    • When using Zend Debugger, make sure the generated PhpStorm bookmarklets or a Browser Debugging Extension is configured to use the correct IP address and port.

    • When using a remote PHP interpreter, verify the steps outlined in Remote debugging via SSH tunnel.

  • In the Settings dialog (Ctrl+Alt+S), navigate to and make sure PhpStorm and Xdebug / Zend Debugger are configured with the same port numbers.

  • In PhpStorm, enable listening to incoming debug connections by either clicking the Start Listening for PHP Debug Connections button on the toolbar/the status bar or selecting in the main menu. This will ensure PhpStorm reacts when a debugging session is started and opens the Debug tool window automatically. Before launching the script, make sure that either a breakpoint is set or the Break at first line in PHP scripts option is enabled on the Debug page of the Settings dialog Ctrl+Alt+S.

  • Verify no firewall, router or ISP is blocking the connection. This can be verified by running telnet host 9000 (for Xdebug) or telnet host 10137 (for Zend Debugger) from remote server (where host is an IP address of your local machine running PhpStorm) and checking a connection is established. You can use http://www.canyouseeme.org or a similar service to check for opened inbound ports.

  • Make sure that xdebug.remote_host (for Xdebug 2), xdebug.client_host (for Xdebug 3), or zend_debugger .allow_hosts (for Zend Debugger) are properly configured. The value can be a host name (for example, localhost) or an IP address of the machine where PhpStorm is running, and it must be pingable from the server. When using Xdebug, xdebug.remote_connect_back (for Xdebug 2) or xdebug.discover_client_host (for Xdebug 3) can be used for troubleshooting.

No Debug Server is Configured

If you initiate a Zero-configuration debugging session without having configured a Debug server, upon establishing connection PhpStorm displays the Incoming Connection dialog where suggests importing mappings from a server access configuration (deployment configuration). If you choose Import mappings from deployment, PhpStorm tries to detect the most suitable deployment configuration, preselects it in the Deployment list, and the Preview area shows the absolute path to the project file, which corresponds to the currently executed script according to the mappings from the selected configuration.

If PhpStorm does not detect a relevant configuration:

  1. Choose the most suitable configuration from the list or click the Browse button and create a new configuration in the Deployment dialog that opens, whereupon the new configuration is added to the list.

  2. In the Deployment root field, type the absolute path to the server root folder.

You can also select the Manually choose local file or project option, in this case PhpStorm displays the project tree view where you can select a project file and map the currently executed script to it. You can also select and map the entire project.

To continue debugging with the imported or manually specified configuration settings, click Accept.

Remote file path is not mapped to any file path in project

In some cases, the debugger can connect, but you get the error messages indicating that no mapping between the remote and project files is defined. This means that PhpStorm cannot determine which local file corresponds to the file being debugged.

No folder mapping is specified

To solve this problem, click Click to set up path mappings and providing the necessary path mappings.

Path mappings are used when the paths to the files processed by the server differ from the paths to the files in the PhpStorm project. This happens in the following cases:

  • The server is remote and the project files are local copies of the originals.

  • The files processed by the server and the files opened in the IDE are the same, but symlinks are used. Because the debugger resolves symlinks during a debugging session, you need to tell the IDE actual solute physical paths to the files on the server.

To configure path mappings, in the Settings dialog (Ctrl+Alt+S), navigate to .

Set up folder mappings

If the files that the server processes are in the project and you are not using symlinks, clear the Use path mappings checkbox. In this case, the IDE will open files according to the paths received from the debugger.

A path mapping specified for a parent directory is automatically applied to all its subdirectories. If necessary, path mappings for any subdirectory or file can be specified.

See Configure synchronization with a server for more details.

Breakpoints are not being hit

When breakpoints are not being hit but the debugger seems to connect, verify the following:

  • Verify the breakpoint is not disabled. Using the menu command Ctrl+Shift+F8, check that breakpoints are enabled. Select the checkbox next to a breakpoint to enable it.

  • Make sure that path mappings are correct.

  • On macOS, when a file or folder is renamed using Finder, and the letter case is changed, PhpStorm may not be able to find the files. If renaming is required, make sure to do it in the IDE or using a terminal and the mv command. Renaming project files or folders using Finder may result in strange behaviour. See here for more details.

  • There are some rare cases when breakpoints can’t be hit due to technical limitations, for example caused by the way how PHP generates bytecode. See here for more details.

When using Xdebug, you can use the xdebug_break() function to force a breakpoint from within PHP. When Xdebug encounters this function during execution, it will pause at the next statement in the IDE even if no breakpoint was defined there originally.

Xdebug ignores a breakpoint and stops at a line where no breakpoint is defined

This can happen due to the Xdebug’s internal breakpoints resolving mechanism. Under this mechanism, the debugger evaluates whether PHP can generate internal executable bytecode for the current line. If no such code is generated for a line, the corresponding breakpoint cannot be hit. Xdebug will scan up to 5 subsequent lines, and stop at the line where executable code is located. Resolving breakpoints is supported in Xdebug 2.8 and later.

If necessary, you can configure breakpoints resolving support in PhpStorm on the page of the Settings dialog (Ctrl+Alt+S):

  • In the Xdebug area, use the Resolve breakpoint if it’s not available on the current line (Xdebug 2.8+) checkbox to toggle breakpoint resolving. Note that if resolving is disabled, the breakpoints set on the code lines without executable code will always be ignored.

  • In the Advanced settings area, use the Notify if breakpoint was resolved to a different line (Xdebug 2.8+) checkbox to choose whether PhpStorm should display a notification message when a breakpoint is resolved.

A script is not suspended

Establishing a Zero-Configuration debugging session may fail with no breakpoints hit and therefore the script not suspended. This may happen if the path mappings are not configured or configured erroneously, or if you have not set any breakpoints. In the latter case, you can do any of the following:

  • Set a breakpoint by clicking the gutter at the desired executable line of code. See Breakpoints for details.

  • In the Settings dialog (Ctrl+Alt+S), go to and in the External Connections area, select the Break at first line in PHP scripts checkbox.

  • Enable the option from the main menu.

To have PhpStorm display a notification if the script is not suspended, select the Notify if debug session was finished without being paused checkbox in the Advanced Settings area on the page of the Settings dialog.

The debugger does not work when using nginx

When using the nginx web server, debugging may fail if the $_SERVER["SERVER_NAME"] is not provided by PHP. To solve this, add a fastcgi parameter to the nginx configuration:

fastcgi_param SERVER_NAME $server_name;

or

fastcgi_param SERVER_NAME $host;

Refer to the nginx documentation and see here for additional details.

Xdebug cannot connect to PhpStorm

If you see the following messages in Xdebug log:

Log opened at 2017-02-21 17:52:27
I: Connecting to configured address/port: 172.19.0.1:9000.
W: Creating socket for ‘172.19.0.1:9000’, poll success, but error: Operation now in progress (29).
E: Could not connect to client. :disappointed:
Log closed at 2017-02-21 17:52:27

or

Log opened at 2017-02-22 13:17:13
I: Connecting to configured address/port: 10.10.10.10:9000.
E: Time-out connecting to client. :-(
Log closed at 2017-02-22 13:17:14

This means that Xdebug tries to connect to the host and can’t make the connection. To fix the issue, set xdebug.remote_connect_back=0 (xdebug.discover_client_host=false for Xdebug 3) and make sure that xdebug.remote_host (xdebug.client_host for Xdebug 3) is set correctly.

Trying to debug a framework CLI command results in PHP errors

When trying to debug a CLI command of a PHP framework command-line tool, such as Symfony Console or Laravel Artisan, debugging fails with a PHP error Fatal error: Class '...Command' not found" or similar.

The common cause for such errors is attempting to debug the file or class with the command directly. Instead, you should use a PHP Script, in which you provide the path to the command-line tool and the actual command to run. In this case, the framework commands bootstrapping logic will apply, and debugging will proceed normally.

PHP Script run/debug configuration for Artisan

Refer to the following framework-specific guides for details:

  • Debugging Symfony CLI commands

  • Debugging Artisan CLI commands

  • Debugging WordPress WP-CLI commands

  • Debugging Drush CLI commands

Zend Debugger will not perform dropping of privileges

When using Zend Debugger on Linux, you may occasionally see the following error:

Zend Debugger: Cannot read a valid value of zend_debugger.httpd_uid or zend.httpd_uid, will not
perform dropping of privileges

This error occurs when the debugger cannot determine the UID of the user running the web server process. Find the UID of that user and add it to php.ini:

zend_debugger.httpd_uid=1234

After updating the setting, restart the web server.

Debugging with ionCube installed

In some PHP environments, ionCube is used to load and run the encoded PHP code. The ionCube loader extension does this by decoding the PHP code that is to be run and then making sure the PHP interpreter can execute it.

Officially, neither Xdebug nor Zend Debugger support running with ionCube enabled, however there are some workarounds to try. Note that these are not supported by JetBrains, ionCube, Xdebug or Zend Debugger.

  • Make sure the ionCube loader module is loaded first

    In php.ini, verify the ionCube loader is loaded before any debugger extension is loaded, for example:

    zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/ioncube_loader_lin_5.4.so
    zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so

  • Use ionCube on-demand loading

    We can disable the ionCube extension in php.ini and make use of ionCube’s on-demand loading feature. When the first encoded PHP script is loaded, the PHP interpreter will check the configured extenson_dir to find the ionCube extension and run the encoded PHP script.

    Note that this method is not officially supported. It should only be used for debugging purposes and never on a production server.

Last modified: 16 September 2022

Содержание

  1. Troubleshooting common PHP debugging issues
  2. Collecting PhpStorm debugging logs
  3. Collect debugging logs
  4. Collecting Xdebug logs
  5. Making sure Xdebug or Zend Debugger are installed and configured
  6. Startup warnings and errors preventing the debugger from working
  7. Debugger cannot connect
  8. No Debug Server is Configured
  9. Remote file path is not mapped to any file path in project
  10. Breakpoints are not being hit
  11. Xdebug ignores a breakpoint and stops at a line where no breakpoint is defined
  12. A script is not suspended
  13. The debugger does not work when using nginx
  14. Xdebug cannot connect to PhpStorm
  15. Trying to debug a framework CLI command results in PHP errors
  16. Zend Debugger will not perform dropping of privileges
  17. Debugging with ionCube installed

Troubleshooting common PHP debugging issues

This section provides the list of solutions and workarounds for common problems with Debugging in PhpStorm.

Collecting PhpStorm debugging logs

If your issue is not addressed in this section, contact our support engineers. If asked to provide deployment logs, follow the instructions to collect them.

Collect debugging logs

Select Help | Configure Debug Log in the main menu.

In the Custom Debug Log Configuration dialog that opens, add the following lines depending on the issues you are experiencing:

Issues with PHP debugging: #com.jetbrains.php.debug

Click OK and reproduce the issue.

Locate the log file by selecting Help | Show Log in Explorer (for Windows and Linux) or Help | Show Log in Finder (for macOS).

If necessary, you can locate the log manually:

The most recent log file is named idea.log ; older files names end with a number, that is idea.log.1 , idea.log.2 , and so on. In most cases you need only the most recent one.

Attach the log file(s) to the issue or forum thread.

Collecting Xdebug logs

When using Xdebug, it is possible to make it log its actions.

In the Settings dialog ( Ctrl+Alt+S ), go to PHP .

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:

file. Close all the dialogs and switch to the tab where the php.ini file is opened.

In the php.ini , enable Xdebug logging by adding the following line:

The log file contains the raw communication between PhpStorm and Xdebug as well as any warnings or errors:

The log file will not automatically roll-over or be truncated and may grow to a vast file size. When logging is no longer needed, it is recommended to disable it.

Making sure Xdebug or Zend Debugger are installed and configured

To debug PHP code with PhpStorm, make sure that you have a debugging engine, either Xdebug or Zend Debugger, installed and configured properly.

These tools cannot be used simultaneously because they block each other. To avoid this problem, you need to update the corresponding sections in the php.ini file as described in Configure Xdebug and Configure Zend Debugger.

To validate the debugging engine configuration, perform the steps described in Validate the Configuration of a Debugging Engine

Startup warnings and errors preventing the debugger from working

When running PHP, it can happen that a startup warning or error is displayed. When this is the case, the debugger may fail to work. PhpStorm will also not be able to recognize the debugger being used.

To verify that no startup warnings or errors are displayed, run the following command:

This will return a message similar to the following:

If any errors or warnings are present on the first lines, it’s recommended to fix them before continuing.

Debugger cannot connect

When the debugger cannot connect or refuses the connection, check the following:

Make sure Xdebug or Zend Debugger are configured to connect to the host and port PhpStorm is running on.

In the Xdebug configuration, make sure xdebug.remote_host and xdebug.remote_port ( xdebug.client_host and xdebug.client_port for Xdebug 3) are correct. Refer to the Xdebug documentation for details.

When using Zend Debugger, make sure the generated PhpStorm bookmarklets or a Browser Debugging Extension is configured to use the correct IP address and port.

When using a remote PHP interpreter, verify the steps outlined in Remote debugging via SSH tunnel.

In the Settings dialog ( Ctrl+Alt+S ), navigate to PHP | Debug and make sure PhpStorm and Xdebug / Zend Debugger are configured with the same port numbers.

In PhpStorm, enable listening to incoming debug connections by either clicking on the toolbar or selecting Run | Start Listening for PHP Debug Connections in the main menu. This will ensure PhpStorm reacts when a debugging session is started and opens the Debug tool window automatically. Before launching the script, make sure that either a breakpoint is set or the Break at first line in PHP scripts option is enabled on the Debug page of the Settings/Preferences dialog Ctrl+Alt+S .

Verify no firewall, router or ISP is blocking the connection. This can be verified by running telnet host 9000 (for Xdebug) or telnet host 10137 (for Zend Debugger) from remote server (where host is an IP address of your local machine running PhpStorm) and checking a connection is established. You can use http://www.canyouseeme.org or a similar service to check for opened inbound ports.

Make sure that xdebug.remote_host (for Xdebug 2), xdebug.client_host (for Xdebug 3), or zend_debugger .allow_hosts (for Zend Debugger) are properly configured. The value can be a host name (for example, localhost ) or an IP address of the machine where PhpStorm is running, and it must be pingable from the server. When using Xdebug, xdebug.remote_connect_back (for Xdebug 2) or xdebug.discover_client_host (for Xdebug 3) can be used for troubleshooting.

No Debug Server is Configured

If you initiate a Zero-configuration debugging session without having configured a Debug server , upon establishing connection PhpStorm displays the Incoming Connection dialog where suggests importing mappings from a server access configuration ( deployment configuration ). If you choose Import mappings from deployment , PhpStorm tries to detect the most suitable deployment configuration, preselects it in the Deployment list, and the Preview area shows the absolute path to the project file, which corresponds to the currently executed script according to the mappings from the selected configuration.

If PhpStorm does not detect a relevant configuration:

Choose the most suitable configuration from the list or click and create a new configuration in the Deployment dialog that opens, whereupon the new configuration is added to the list.

In the Deployment root field, type the absolute path to the server root folder.

You can also select the Manually choose local file or project option, in this case PhpStorm displays the project tree view where you can select a project file and map the currently executed script to it. You can also select and map the entire project.

Path mappings cannot be set for project files or folders that are marked as excluded.

To continue debugging with the imported or manually specified configuration settings, click Accept .

Remote file path is not mapped to any file path in project

In some cases, the debugger can connect, but you get the error messages indicating that no mapping between the remote and project files is defined. This means that PhpStorm cannot determine which local file corresponds to the file being debugged.

To solve this problem, click Click to set up path mappings and providing the necessary path mappings.

Path mappings are used when the paths to the files processed by the server differ from the paths to the files in the PhpStorm project. This happens in the following cases:

The server is remote and the project files are local copies of the originals.

The files processed by the server and the files opened in the IDE are the same, but symlinks are used. Because the debugger resolves symlinks during a debugging session, you need to tell the IDE actual solute physical paths to the files on the server.

To configure path mappings, in the Settings dialog ( Ctrl+Alt+S ), navigate to PHP | Servers .

If the files that the server processes are in the project and you are not using symlinks, clear the Use path mappings checkbox. In this case, the IDE will open files according to the paths received from the debugger.

A path mapping specified for a parent directory is automatically applied to all its subdirectories. If necessary, path mappings for any subdirectory or file can be specified.

Path mappings cannot be set for project files or folders that are marked as excluded.

Breakpoints are not being hit

When breakpoints are not being hit but the debugger seems to connect, verify the following:

Verify the breakpoint is not disabled. Using the Run | View Breakpoints menu command Ctrl+Shift+F8 , check that breakpoints are enabled. Select the checkbox next to a breakpoint to enable it.

On macOS, when a file or folder is renamed using Finder, and the letter case is changed, PhpStorm may not be able to find the files. If renaming is required, make sure to do it in the IDE or using a terminal and the mv command. Renaming project files or folders using Finder may result in strange behaviour. See here for more details.

There are some rare cases when breakpoints can’t be hit due to technical limitations, for example caused by the way how PHP generates bytecode. See here for more details.

When using Xdebug, you can use the xdebug_break() function to force a breakpoint from within PHP. When Xdebug encounters this function during execution, it will pause at the next statement in the IDE even if no breakpoint was defined there originally.

Xdebug ignores a breakpoint and stops at a line where no breakpoint is defined

This can happen due to the Xdebug’s internal breakpoints resolving mechanism. Under this mechanism, the debugger evaluates whether PHP can generate internal executable bytecode for the current line. If no such code is generated for a line, the corresponding breakpoint cannot be hit. Xdebug will scan up to 5 subsequent lines, and stop at the line where executable code is located. Resolving breakpoints is supported in Xdebug 2.8 and later.

If necessary, you can configure breakpoints resolving support in PhpStorm on the PHP | Debug page of the Settings dialog ( Ctrl+Alt+S ):

In the Xdebug area, use the Resolve breakpoint if it’s not available on the current line (Xdebug 2.8+) checkbox to toggle breakpoint resolving. Note that if resolving is disabled, the breakpoints set on the code lines without executable code will always be ignored.

In the Advanced settings area, use the Notify if breakpoint was resolved to a different line (Xdebug 2.8+) checkbox to choose whether PhpStorm should display a notification message when a breakpoint is resolved.

To get an in-depth technical overview of how breakpoints resolving works, refer to this article and DBGP documentation.

A script is not suspended

Establishing a Zero-Configuration debugging session may fail with no breakpoints hit and therefore the script not suspended. This may happen if the path mappings are not configured or configured erroneously, or if you have not set any breakpoints. In the latter case, you can do any of the following:

Set a breakpoint by clicking the gutter at the desired executable line of code. See Breakpoints for details.

In the Settings dialog ( Ctrl+Alt+S ), go to PHP | Debug and in the External Connections area, select the Break at first line in PHP scripts checkbox.

Enable the Run | Break at first line in PHP scripts option from the main menu.

To have PhpStorm display a notification if the script is not suspended, select the Notify if debug session was finished without being paused checkbox in the Advanced Settings area on the PHP | Debug page of the Settings dialog.

The debugger does not work when using nginx

When using the nginx web server, debugging may fail if the $_SERVER[«SERVER_NAME»] is not provided by PHP. To solve this, add a fastcgi parameter to the nginx configuration:

Refer to the nginx documentation and see here for additional details.

Xdebug cannot connect to PhpStorm

If you see the following messages in Xdebug log:

This means that Xdebug tries to connect to the host and can’t make the connection. To fix the issue, set xdebug.remote_connect_back=0 ( xdebug.discover_client_host=false for Xdebug 3) and make sure that xdebug.remote_host ( xdebug.client_host for Xdebug 3) is set correctly.

Trying to debug a framework CLI command results in PHP errors

When trying to debug a CLI command of a PHP framework command-line tool, such as Symfony Console or Laravel Artisan , debugging fails with a PHP error Fatal error: Class ‘. Command’ not found» or similar.

The common cause for such errors is attempting to debug the file or class with the command directly. Instead, you should use a PHP Script, in which you provide the path to the command-line tool and the actual command to run. In this case, the framework commands bootstrapping logic will apply, and debugging will proceed normally.

Refer to the following framework-specific guides for details:

Zend Debugger will not perform dropping of privileges

When using Zend Debugger on Linux, you may occasionally see the following error:

This error occurs when the debugger cannot determine the UID of the user running the web server process. Find the UID of that user and add it to php.ini :

After updating the setting, restart the web server.

Debugging with ionCube installed

In some PHP environments, ionCube is used to load and run the encoded PHP code. The ionCube loader extension does this by decoding the PHP code that is to be run and then making sure the PHP interpreter can execute it.

Officially, neither Xdebug nor Zend Debugger support running with ionCube enabled, however there are some workarounds to try. Note that these are not supported by JetBrains, ionCube, Xdebug or Zend Debugger.

Make sure the ionCube loader module is loaded first

In php.ini , verify the ionCube loader is loaded before any debugger extension is loaded, for example:

Use ionCube on-demand loading

We can disable the ionCube extension in php.ini and make use of ionCube’s on-demand loading feature. When the first encoded PHP script is loaded, the PHP interpreter will check the configured extenson_dir to find the ionCube extension and run the encoded PHP script.

Note that this method is not officially supported. It should only be used for debugging purposes and never on a production server.

Источник

derick

2019-01-22 22:07

administrator  

~0004826

Can you reproduce this problem on the command line as well? It might be worth trying that. Run your PHP script as follows:

USE_ZEND_ALLOC=0 XDEBUG_CONFIG=»idekey=cegprakash» php -n -dzend_extension=/usr/lib/php/20151012/xdebug.so -dxdebug.auto_start=1 -dxdebug.remote_log=»/usr/lib/php/xdebug-logs.log» your-simplest-script.php

And then check again what is in /usr/lib/php/xdebug-logs.log

cegprakash

2019-01-23 10:20

reporter  

~0004839

Yes I get the same logs.

I also get the following message in command line

Xdebug requires Zend Engine API version 320151012.
The Zend Engine API version 320170718 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later version of Xdebug.

cegprakash

2019-01-23 10:56

reporter  

~0004841

So I tried

SE_ZEND_ALLOC=0 XDEBUG_CONFIG=»idekey=cegprakash» php -n -dzend_extension=/usr/lib/php/20170718/xdebug.so -dxdebug.auto_start=1 -dxdebug.remote_log=»/usr/lib/php/xdebug-logs.log» info.php

and it just prints the same log

Log opened at 2019-01-23 10:49:30
I: Connecting to configured address/port: localhost:9000.
W: Creating socket for ‘localhost:9000’, poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2019-01-23 10:49:30

Kier

2019-07-23 12:31

reporter  

~0005087

Just a note to say I’m seeing this precise issue with Xdebug 2.7.1 on an Ubuntu 18.04 Vagrant machine, which is being debugged by PHPStorm under Mojave.

The command run by PHPStorm was
[vagrant:///Users/kier/Sites/xf-sbp]:/usr/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=172.16.141.2 /var/www/public/xf/cmd.php

And the resulting log entry was as follows:
[3484] Log opened at 2019-07-23 12:28:57
[3484] I: Connecting to configured address/port: 172.16.141.2:9000.
[3484] W: Creating socket for ‘172.16.141.2:9000’, poll success, but error: Operation now in progress (29).
[3484] E: Could not connect to client. :-(
[3484] Log closed at 2019-07-23 12:28:57

If I can run any other tests to help isolate the issue, please let me know.

Kier

2019-07-23 12:32

reporter  

~0005088

Might be worth noting that the following from inside the Vagrant machine:

nc -vz 172.16.141.2 9000
nc: connect to 172.16.141.2 port 9000 (tcp) failed: Connection refused

derick

2019-07-23 13:02

administrator  

~0005089

@Kier — that sounds like a networking issue on your side. If Xdebug/PHP can’t connect to the IDE, then it can’t debug. Your «nc» call just proved that it can’t connect, which means that PhpStorm is not listening on port 9000 on IP address 172.16.141.2. That looks like an internal Vagrant IP address, which is likely not shared through to PhpStorm. I’d recommend you put Vagrant’s network into «Bridged» mode, instead of the (Default) NAT.

Kier

2019-07-23 14:03

reporter  

net1.png (947,654 bytes)

net2.png (947,708 bytes)

config.png (450,219 bytes)

Kier

2019-07-23 14:03

reporter  

~0005090

@derick This is starting to look like an issue with Vagrant, VMware Fusion or PHPStorm but I thought it would be useful to update this report anyway with my findings.

The virtual machine reports the following IP configuration:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.141.139 netmask 255.255.255.0 broadcast 172.16.141.255

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.33.10 netmask 255.255.255.0 broadcast 192.168.33.255

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0

Debugging PHP scripts running through Apache into Chrome is working flawlessly. The debug logs show that the connection is passing to 192.168.33.1, which is using the vmnet2 interface on the virtual machine (fig: net2.png).

[1307] Log opened at 2019-07-23 13:43:27
[1307] I: Checking remote connect back address.
[1307] I: Checking header ‘HTTP_X_FORWARDED_FOR’.
[1307] I: Checking header ‘REMOTE_ADDR’.
[1307] I: Remote address found, connecting to 192.168.33.1:9000.
[1307] I: Connected to client. :-)

However, using the standard PHPStorm config, which is to ‘Pass required configuration options through command line’ (fig: config.png), it would appear that PHPStorm will instead attempt to connect through the first defined network interface, which is the 172.16.141.x address we see (fig: net1.png). Connection over port 9000, or any other port that I have tried, is refused. Using these options, the following debug command is run:

[vagrant:///Users/kier/Sites/xf-sbp]:/usr/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=172.16.141.2 /var/www/public/xf/cmd.php

Clearly, PHPStorm is connecting to the wrong IP for the virtual machine, but there doesn’t appear to be a way to correct that, so instead it is necessary to disable that option to have PHPStorm send command-line configuration, and instead we must rely on Xdebug config itself. Setting xdebug.remote_host = 192.168.33.1 and disabling PHPStorm’s «Pass required configuration options through command line» option allows debugging to work correctly.

[vagrant:///Users/kier/Sites/xf-sbp]:/usr/bin/php /var/www/public/xf/cmd.php

results in

[2276] Log opened at 2019-07-23 14:01:10
[2276] I: Checking remote connect back address.
[2276] I: Checking header ‘HTTP_X_FORWARDED_FOR’.
[2276] I: Checking header ‘REMOTE_ADDR’.
[2276] W: Remote address not found, connecting to configured address/port: 192.168.33.1:9000. :-|
[2276] I: Connected to client. :-)

derick

2019-07-24 10:38

administrator  

~0005091

Hi Keir,

I would log a support question with PhpStorm, as in my opinion, they do this wrong. I fail to understand how they get that IP address in the first place, but that’s something for them to investigate.

cheers,
Derick

Kier

2019-07-24 10:42

reporter  

~0005092

Will do, @derick. Thanks for a great project in Xdebug.

derick

2019-08-01 14:06

administrator  

~0005098

I’m closing this issue, as so far, there is nothing that indicates that Xdebug is doing something wrong.

cheers,
Derick

Я пытаюсь отладить сценарий CLI, и Xdebug не может подключиться к PhpStorm.
Я вижу ошибку Operation now in progress (29). в удаленном журнале Xdebug.
Я уверен, что Xdebug настроен правильно, но я не знаю, как отлаживать PhpStorm .

Сводка из phpinfo (), созданная https://xdebug.org/wizard.php

Tailored Installation Instructions
Summary
Xdebug installed: 2.6.1
Server API: Command Line Interface
Windows: no
Zend Server: no
PHP Version: 7.1.24
Zend API nr: 320160303
PHP API nr: 20160303
Debug Build: no
Thread Safe Build: no
OPcache Loaded: no
Configuration File Path: /usr/local/etc/php
Configuration File: /usr/local/etc/php/php.ini
Extensions directory: /usr/local/lib/php/extensions/no-debug-non-zts-20160303
You're already running the latest Xdebug version

Журнал Xdebug

Log opened at 2019-02-19 11:59:37
I: Connecting to configured address/port: 46.201.50.194:9000.
W: Creating socket for '46.201.50.194:9000', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2019-02-19 11:59:37

Конфигурация Xdebug

xdebug

xdebug support => enabled
Version => 2.6.1
IDE Key => PHPSTORM

Supported protocols
DBGp - Common DeBuGger Protocol

Directive => Local Value => Master Value
xdebug.auto_trace => Off => Off
xdebug.cli_color => 0 => 0
xdebug.collect_assignments => Off => Off
xdebug.collect_includes => On => On
xdebug.collect_params => 0 => 0
xdebug.collect_return => Off => Off
xdebug.collect_vars => Off => Off
xdebug.coverage_enable => On => On
xdebug.default_enable => On => On
xdebug.dump.COOKIE => no value => no value
xdebug.dump.ENV => no value => no value
xdebug.dump.FILES => no value => no value
xdebug.dump.GET => no value => no value
xdebug.dump.POST => no value => no value
xdebug.dump.REQUEST => no value => no value
xdebug.dump.SERVER => no value => no value
xdebug.dump.SESSION => no value => no value
xdebug.dump_globals => On => On
xdebug.dump_once => On => On
xdebug.dump_undefined => Off => Off
xdebug.extended_info => On => On
xdebug.file_link_format => no value => no value
xdebug.filename_format => no value => no value
xdebug.force_display_errors => Off => Off
xdebug.force_error_reporting => 0 => 0
xdebug.gc_stats_enable => Off => Off
xdebug.gc_stats_output_dir => /tmp => /tmp
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.halt_level => 0 => 0
xdebug.idekey => PHPSTORM => PHPSTORM
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.overload_var_dump => 2 => 2
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_enable_trigger_value => no value => no value
xdebug.profiler_output_dir => /tmp => /tmp
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_addr_header => no value => no value
xdebug.remote_autostart => On => On
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => 127.0.0.1 => localhost
xdebug.remote_log => /app/xdebug.log => no value
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.remote_timeout => 200 => 200
xdebug.scream => Off => Off
xdebug.show_error_trace => Off => Off
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.show_mem_delta => Off => Off
xdebug.trace_enable_trigger => Off => Off
xdebug.trace_enable_trigger_value => no value => no value
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /tmp => /tmp
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3

введите описание изображения здесь

Я пытаюсь настроить PhpStorm для работы с Xdebug на удаленном сервере. С Xdebug на локальном хосте с WAMP это работает.

Я использовал Putty для туннелирования порта 9000 с моего удаленного сервера, работает telnetting, я получаю черный экран.

Конфигурация Xdebug выглядит следующим образом:

zend_extension = /usr/lib64/php/modules/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_host="127.0.0.1"xdebug.remote_autostart =1
xdebug.remote_enable =1
xdebug.remote_port=9000

Всякий раз, когда я нажимаю отладку на PhpStorm, я по какой-то причине зависает при «подключении к localhost: 3308».

Я использую Xdebug helper 1.6.1 в Chrome 63. На своем сервере я использую Xdebug 2.6 с PHP версии 7.1.10. Я использую PhpStorm 2017.3.1.

РЕДАКТИРОВАТЬ 1:
кажется, что журнал не открыт на стороне сервера, вот журнал:

Log opened at 2017-12-26 11:11:31
I: Connecting to configured address/port: 127.0.0.1:9009.
W: Creating socket for '127.0.0.1:9009', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2017-12-26 11:11:31

Log opened at 2017-12-26 11:11:31
I: Connecting to configured address/port: 127.0.0.1:9009.
W: Creating socket for '127.0.0.1:9009', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2017-12-26 11:11:31

Log opened at 2017-12-26 11:11:31
I: Connecting to configured address/port: 127.0.0.1:9009.
W: Creating socket for '127.0.0.1:9009', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2017-12-26 11:11:31

Log opened at 2017-12-26 11:11:31
I: Connecting to configured address/port: 127.0.0.1:9009.
W: Creating socket for '127.0.0.1:9009', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2017-12-26 11:11:31

Log opened at 2017-12-26 11:11:31
I: Connecting to configured address/port: 127.0.0.1:9009.
W: Creating socket for '127.0.0.1:9009', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2017-12-26 11:11:31

локальный telnetting к порту 9009 отклонен.

Кто-нибудь знает, почему это не работает?

0

Решение

Измените порт на 9009 и не забудьте изменить этот параметр в PhpStorm

2

Другие решения

Других решений пока нет …

Понравилась статья? Поделить с друзьями:
  • Policy violation or system error
  • Policy manager down vpn как исправить
  • Police simulator patrol officers ошибка
  • Polaris робот пылесос pvcr 0726w ошибки
  • Polaris ошибка p1555