开发者

phpstorm and xdebug breakpoints

开发者 https://www.devze.com 2023-03-11 21:25 出处:网络
I usephpstorm to develop websites, but for some reason breakpoints aren\'t synchronized. Here is my situation:

I use phpstorm to develop websites, but for some reason breakpoints aren't synchronized. Here is my situation:

I have a f开发者_JAVA技巧older in which I keep all my projects. On the same pc, I have also xampp running as a testing server. In phpstorm I have the xampp testing server configured as a mounted folder server. But when I apply breakpoints in the original source files, those breakpoints aren't synchronized with the files in the htdocs folder of xampp. How can I solve this?


Looks like you need to set path mappings. There are some information about that - http://blogs.jetbrains.com/webide/2011/03/configure-php-debugging-in-phpstorm-2-0/


I had similar problem when I set a breakpoint but it didnt stop on it while debugging. My webserver uses a virtual drive letter to make httdocs path easier. So my mistake was that I had not set virtual path as content root of the project in File-Settings-Directories but a real path to my local folder


I was having a similar problem with phpstorm 4.x / xdebug 2.2.3 / php 5.4.3

I could set a break point high up in the code and it would work, but stepping through the lines I could see that the debugger was getting out of sync with the actual code. This meant that some break points were skipped over.

After a lot of experimentation, I finally worked that out the problem was caused by me having line breaks in my vars.

For example:

    $q = "SELECT * 
    FROM table
    WHERE
    product_id = 'whatever'
    AND product_status != 'inactive'";

would throw the debugger out by 4 - 5 lines when it got to this statement.

Changing this to:

$q = "SELECT * FROM table WHERE product_id = 'whatever' AND product_status != 'inactive'";

fixed the problem!

Obviously this would affect any var declaration with line breaks, not just those intended for SQL queries. Bit of a pain, because I do this for readability, but I hope this saves some time for someone else with the same problem.


Maybe this doesn't work for you but I just have my MAMP's home folder point to the root folder of my project, so no syncing/mounting is needed

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号