Debug PHP
Hello,
I cannot debug PHP code, I hope you can help me with it....
I have the Xdebug configured to work as below, and the Run configuration with Built-in Web Server (localhost:9000), but when I run the web site (wordpress) the browser waits for response without getting it, no answer... just waiting.
I have also tried to run the web site under a different port 40268, in this case it runs and the web pages are displayed in the browser but I cannot stop the code on breakpoints. In both cases the PHPStorm button "Start Listening" is enabled.
Thank you all.
[Xdebug]
zend_extension="C:\php5.6_86TS\ext\xdebug.dll"
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir=""C:\php5.6_86TS\temp"

请先登录再写评论。
Hi there,
This is wrong. Where all who does such setup getting this idea from? Or is it "I see some port number -- I must put it here just because it's a port number, what can go wrong" ?
Xdebug port is for debugging only -- it is NOT meant to serve any web requests. Although I have seen some working nginx+php setups where nginx was communicating with php on that port. As a result debugging (configured using defaults) was not working (for obvious reason).
So:
1) Do not use xdebug's 9000 port in URLs anywhere -- use standard 80, 8000, 8080 or any other non-standard port number (unless, of course, you change xdebug to work with different port, e.g. 9001)
2) The xdebug's port (9000 by default) should only be in your php.ini and here: "Settings/Preferences | Languages & Frameworks | PHP | Debugging | xdebug port". If you have changed it to some another port number then those are 2 places where it should be changed.
The port number in "Settings/Preferences | Build, Execution, Deployment | Debugger" should NOT be 9000 -- leave it at default 63342 (IDE restart may be required for this change).
3) Please show xdebug section of phpinfo(); output captured in the same way as debugging (e.g. if meant to debug via browser then capture it via browser). On certain systems/configs (mainly Mac/linux) you may have different php.ini for CLI and web server.
4) Provide xdebug log for such debug attempt: http://xdebug.org/docs/all_settings#remote_log
BTW -- "C:\php5.6_86TS\ext\xdebug.dll" -- you are suing Thread-Safe build of PHP. Make sure that you are using thread-safe build of xdebug as well.
In general I would recommend:
1) reset your project settings regarding debugging to get rid from wrong ports etc (as last resort: delete .idea subfolder while project is closed; then just use "Open" to re-open that project again and configure it from scratch)
2) Have a look at some manuals. If followed correctly you should have it running with no issues:
3) Try placing breakpoints on simple single line instructions. On some multi-line statements xdebug may not break (due to the way how PHP generates byte code -- sometimes the line where breakpoint must be set could be line #2 or #3 instead of #1).
4) You can also try programmatic breakpoint -- add xdebug_break(); in your code where you want it to break.
Hi, thanks for help...
I cleaded the project, I made the localhost running on both the default PHP Storm port or 9001 but I couldn't debug. I also re-downaloded the Xdebug DLL following the web site widzard to get the right DLL (by phpinfo automatic check). The web site runs but the IDE doesn't stop on breakpoints.
Below my PHP Info:
=============================================================================================
PHP Version 5.6.15
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans
Configuration
bcmath
calendar
cli_server
Core
ctype
date
dom
ereg
filter
ftp
hash
iconv
json
libxml
mcrypt
mhash
mysql
mysqlnd
odbc
pcre
PDO
pdo_mysql
Phar
Phar fully realized by Gregory Beaver and Marcus Boerger.
Portions of tar implementation Copyright (c) 2003-2009 Tim Kientzle.
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
zip
zlib
Additional Modules
Environment
PHP Variables
PHP Credits
PHP License
This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net.
1
Config looks OK -- the basic minimum is there.
What xdebug log say about debug attempt?