Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPStorm / debugger not stopping at certain breakpoints

I've set up XDebug (2.2.1) and PHPStorm-IDE (Mac OS X 10.7.5) with standard LAMP stack for Mac OS (Apache 2.2.22, PHP 5.3.15).

/etc/php.ini

[xdebug]
zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
xdebug.file_link_format="txmt://open?url=file://%f&line=%1"
xdebug.remote_enable = On
xdebug.remote_autostart = "PHPSTORM"
xdebug.var_display_max_data = 1024
xdebug.dump.GET=*
xdebug.dump.POST=*
xdebug.show_local_vars=On
xdebug.dump.SERVER=*
xdebug.dump_globals=On
xdebug.collect_params=4

I followed these two tutorials and it works in 99% of my project files:

  • http://blog.jetbrains.com/webide/2011/03/configure-php-debugging-in-phpstorm-2-0/
  • http://blog.jetbrains.com/webide/2011/02/zero-configuration-debugging-with-xdebug-and-phpstorm-2-0/

I use Zend Frameworks MVC architecture. I am able to stop at breakpoints in most of my controller classes, but in some other controllers PHPStorm ignores all of my breakpoints.

Do you have any suggestions? How can I debug the debugger? What kind of configuration error could cause that?

Thanks for your help.

like image 250
Simon Avatar asked Aug 19 '13 14:08

Simon


People also ask

How do I use breakpoints in PhpStorm?

Breakpoints' properties You can configure PhpStorm to enable/disable breakpoints on clicking rather than removing them altogether. To do this, go to Settings/Preferences | Build, Execution, Deployment | Debugger and set the Remove breakpoint option to Drag to the editor or click with middle mouse button.

Why is xdebug not working?

Xdebug cannot connect to PhpStorm 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.

What is Xdebug_session_start PhpStorm?

Google Dork Description: inurl:?XDEBUG_SESSION_START=phpstorm. Google Search: inurl:?XDEBUG_SESSION_START=phpstorm. #Google Dork : inurl:?XDEBUG_SESSION_START #Summary: Xdebug is a php extension that allows to debug php pages, remotely by using DGBp protocol. -

How do I enable breakpoint in PhpStorm?

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.

Why can't I debug my PhpStorm code?

Go to settings in phpstorm and then debug, check the box 'break at first line...' Could be the breakpoints aren't working because it can't find the file.

Why doesn't the debugger stop on breakpoints when I debug?

This article helps you resolve a problem where the debugger doesn't stop on breakpoints when you debug ASP.NET applications in Microsoft Visual Studio .NET. When you debug ASP.NET applications in Visual Studio .NET, the debugger might not stop on breakpoints. This problem occurs because ASP.NET debugging isn't enabled on the application.

How does Xdebug work with PhpStorm?

When using Xdebug, PhpStorm can employ its 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.


2 Answers

This almost has to be the result of mismapped paths in phpstorm. You can configure paths in Settings->PHP->Servers. I ran into a similar problem and all I had to do was to set the correct absolute path on the server (where xdebug is running) in the mapping for the root of my code in phpstorm. e.g. c:\my\code\lives\here\on\my\dev\box => /myserver/my/code/lives/here/on/my/actual/server.

Here is a more complete solution, and some tips on debugging XDebug in general:

  1. Add a remote log file to your xdebug settings: xdebug.remote_log = /path/to/logs/xdebug.log

  2. Restart apache

  3. Tail the log (I'm assuming you can do this in OSX) tail -f /path/to/logs/xdebug.log

--You might see something obviously wrong by keeping track of the log contents the next time you try to debug a page. If so, just do whatever you need to do. If not, let's still assume it's a mismapping of paths and continue to try to fix that:--

  1. Set a breakpoint where you know PHPStorm/XDebug will actually stop and make it stop there. In a lot of places on the web people report index.php being the easiest place to make PHPStorm actually stop at a breakpoint for the first time.

  2. In a file that you can't get PHPStorm/XDebug to stop in, set and unset a breakpoint while PHPStorm is stopped at the breakpoint in the index.php file. You should see lines in your xdebug log file that look like this:

<- breakpoint_set -i 19 -t line -f file:///myserver/my/code/lives/here/on/my/actual/server/file.php -n 159 ->

  1. See if the file actually does live where XDebug is looking for it e.g.

tail /myserver/my/code/lives/here/on/my/actual/server/file.php

  1. If the file doesn't actually live there, adjust the path mappings in your PHPStorm settings until PHPStorm is telling XDebug to look at files that actually exist. e.g. if XDebug had said file=/mysrver/my/code/lives/here/on/my/actual/server/file.php, then in step 6 you would have noticed the file didn't exist on the server, and then you might realize "oh oops I spelled myserver wrong in the path mapping", and fixing the spelling in PHPStorm would then probably fix the issue.

This is a bit of an old thread but hopefully this will help someone eventually :)

like image 155
adavea Avatar answered Jan 01 '23 13:01

adavea


OK, I had the same problem and dug around the PHPStorm bug tracking and also their dev forums.

It turns out that you need to make sure that the path to the file in which breakpoints don't work are exactly as they are (lower/upper case wise) on your MAC. I just migrated a project from Windows with mixed upper/lower case folders and file names on the drive and different cases in the require_once directives.

Once I made sure the path in the require_once matched the case on the disk, then my breakpoints started to work again!

See here http://devnet.jetbrains.com/message/5488439

like image 41
Breiz Avatar answered Jan 01 '23 13:01

Breiz