I'm using PhpStorm 2017.2.4, and programming with PHP 5.6 (for technical purposes).
Because I'm using PHP 5.6, since Xdebug only supports PHP 7 and upwards, I cannot use it to debug my code - hence I have to use Zend Debugger.
I've been trying to attach Zend Debugger to PhpStorm by following this video, though it doesn't seem to work.
I'd like to be able to debug PHP similarly to how I'd debug JavaScript with Chrome Developer Tools (breakpoints, check variable values, etc.)
What I've been trying, so far:
Download the Zend Debugger ZIP, extract ZendDbugger.dll to C:\xampp\php\ext and add to php.ini:
[Zend Debugger]
zend_exxtension_ts="C:\xampp\php\ext\ZendDebugger.dll"
zend_debugger_allow_hosts=localhost
zend_debugger.expose_remotely=allowed_hosts
I tried clicking this > + > PHP Web Application > Server ... > + > Name: localhost, Host: localhost, Debugger: Zend Debugger > OK > OK
Set a break point, so I know that the debugger works > Shift+F10 > Enter an input into the text field and submit > PhpStorm's The break point isn't triggered
I thought that I may have missed a step due to PhpStorm's bookmarklet instructions, so I put the Start Debugger one, restarted the webpage, entered the input, pressed Start Debugger and submitted - but no, no breakpoint was triggered.
What have I missed?
Thanks!
you need to install a chrome extension to link your page to phpstorm debug functionality. something like this one : https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en
I came across a similar scenario and I could debug PHP 5.6 in PHP Storm with the following steps.
Installed XAMPP 5.6 via this link
It's bundled with php_xdebug.dll and therefore no need to download it from xdebug.org. In case you don't have it can be download from here.
Update php.ini by appending the following lines at the end of the file.
[xdebug]
zend_extension="C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir=C:\Temp
xdebug.idekey=PHPSTORM
xdebug.remote_autostart = 1
Restart Apache Server
Install 'Xdebug helper' extension to chrome.
Now in PHP Storm click on "Start Listening for PHP Debug Connections" button and you should be able to hit your breakpoints.
I have tried to set up Xdebug (2.2.3) with PhpStorm 7.0 and I cannot bring up the step-through debugging console as I have in the past. The guides that I have used to set this up are:
https://www.jetbrains.com/phpstorm/webhelp/configuring-xdebug.html
http://blog.jetbrains.com/webide/2011/02/zero-configuration-debugging-with-xdebug-and-phpstorm-2-0/
I know that the Xdebug extension itself is working as the cachegrind.out.3280 files are being created on page load (with 12Mb litany of all of the scripts required and variables/values). My set up in php.ini (php version 5.4.12) is:
zend_extension="c:/wamp/bin/php/php5.4.12/zend_ext/php_xdebug-2.2.3-5.4-vc9-x86_64.dll"
xdebug.profiler_output_dir="c:/wamp/tmp"
xdebug.profiler_output_name="cachegrind.out.%p"
xdebug.profiler_enable=1
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.idekey=xdebug
xdebug.remote_connect_back=1
xdebug.remote_host=dashboard.dev
After setting a break point, turning on Xdebug chrome extension, clicking to listen to Xdebug within PhpStorm and refreshing, I get the Incoming Connection from Xdebug dialogue:
However, when I click Accept, the dialogue disappears and nothing happens.
If I then go to Settings / PHP / Servers in PhpStorm, I see that a new entry has been created:
Only by deleting the entry that was added can I get the Incoming Connection dialogue to show up again when I refresh the page. I notice that the port is set to 80 so wondering if that is right since the Xdebug extension is set to run over port 9000; when I click "Validate remote environment" select deployment server, then "Validate", I get: No debug extension is loaded. So I am assuming that the problem is something related to how this is set up.
The problem was fixed by adding the break points to other parts of the code as it was not working when attached to the try clause. Additionally, here are some other tips that might be useful:
Try using a programmatic breakpoint: xdebug_break();
Check that if your php is 32bit then so is the version of Xdebug (or that they are both 64 bit).
The xdebug remote host setting relates to the server IP address (so 127.0.0.1 for local).
You need to configure the mapping between server path and local path in preferences / server
In your Phpstorm goto File > Settings > Languages & Frameworks > PHP > Debug.
Under External conections section, mark the checkbox saying
Ignore external connections through unregistered server configurations
This was fixed for me.
I am trying to get xdebug working with eclipse (3.5) / php (on xampp windows 7). I have verified xdebug is enabled in php - I have the fancy output and my phpinfo shows all the xdebug stuff. I have remote debug on, and typed in the lan ip address on my eclipse machine.
When I tell eclipse to debug, it launches the browser and passes the debug URL parameters. That looks OK.
However, in eclipse debug perspective it shows 'launching myproject' 57% 'waiting for xdebug session'. It sits there forever.
I have turned off windows firewall on both machines.
I tried turning implicit flush on.
Any ideas?
I had this problem too and I was missing this line in the php.ini file:
xdebug.remote_enable = On
Make sure you defined zend_extention with ABSOLUTE path in the php.ini:
e.g.: zend_extension=D:\SANDBOX\server\php\php_xdebug-2.1.0-5.3-vc6.dll
I'm debugging a local project on Windows. So far I did not need xdebug.remote_enable = On.
Suggestions if the Xdebug session does not start (hangs at 57 %), make sure that:
zend_extention directive is set with absolute path and the debug is loaded, use phpinfo() to check
firewall does not block the default 9000 port or Eclipse.
another application is not using the port (execute: netstat -an |find /i "listening" from the command line)
If you need to setup a different port use in php.ini:
xdebug.remote_enable = on
xdebug.remote_port = XXXX
and correct the Xdebug settings in Eclipse:
I had the same problem and I fixed it by changing the port to XDebug (now using port 9001).
Here is my php.ini content:
zend_extension ="C:\...\EasyPHP-5.3.3\php\ext\php_xdebug-2.dll"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.remote_mode=req
xdebug.remote_autostart=0
Also check the apache log file and make sure that you don't have the following Warning message:
PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
If you do, open the php.ini file and comment with a ';' the extension=php_xdebug-2.dll line:
;extension=php_xmlrpc.dll
extension=php_xsl.dll
**;extension=php_xdebug-2.dll**
;/PHPExt
After fighting for 3 hours and trying out every solution on forums, I found out that the simple trick was to remove the quotes while specifying the path of the Xdebug dll in zend_extension in php.ini. I am using XAMPP (PHP 5.3.6 + Apache 2.2)+ Eclipse Indigo + PDT + Xdebug 2.1.2 on Windows Vista.
Here is the exact configuration that worked for me -
zend_extension=C:\xampp\php\ext\php_xdebug-2.1.2-5.3-vc6.dll
#Note that the path above is not in quotes
xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir=C:\xampp\tmp
I have used port 9001 so that it does not clash with 9000 in case that's already used by another program. Make sure this matches the port in Eclipse > Preferences > PHP > Debug > Xdebug too. Also, restart apache after editing php.ini.
Once I added this to php.ini, everything worked like ice cream.
I had the same problem with Zend Studio. I have noticed that the xdebug session was not starting properly. I passed this string to the url once and it worked since then.
http://localhost/myalias/?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=13750956767461
I'm sure it's a matter of configuration somewhere in the IDE.
I realized that TCP port was in use and that was the reason why it was hanging. I changed port in php.ini and eclipse settings.
Check that Eclipse's web browser settings are correct.
Window/Preferences/General/Web Browser/external Web Browsers/Edit settings
In my case, the path to the external web browser binary was incorrect. It said "/usr/bin/mozilla" instead of "/usr/bin/firefox".
Don't know how this setting came about, but after changing it the firefox browser window came up at last.
I looked into apache log and there were many lines with file not found error.
Run -> Debug configurations -> PHP web page -> Your_configuration
I unchecked auto generate and set filename to index.php.
It seems that in case of any mistake that prevents eclipse from normal functioning causes this "waiting for session"
I had the exact same problem. My configs were par with yours and in addition to having xdebug.remote_enable = On in the php.ini file also adding the following:
xdebug.remote_connect_back=1
this enables multihost remote debugging, as an alternative you can define the host IP.
xdebug.remote_host=IP_ADDRESS
For me, adding the [xdebug] configurations suggested by others to a php.ini file kept in following path C:\wamp64\bin\apache\apache2.4.23\bin helped. Essentially it's a symbolic link that points/links to phpForApache.ini file under your respective php version folder that gets installed with wamp64 e.g. php5.6.25.
In nutshell, adding following lines phpForApache.ini to helped me -
zend_extension = c:\wamp64\bin\php\php5.6.25\ext\php_xdebug-2.5.1-5.6-vc11-x86_64.dll
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
Hope this helps
Yeah, check network/port stats. In my case I'm using vmware fusion on mac, and the process vmware-natd was hogging the cpu (blocking on an open port I'm assuming), which I didn't notice. php.ini was completely fine, had to run this to get it to work again:
sudo "/Library/Application Support/VMware Fusion/boot.sh" --restart
So ppl check your php.ini (or xdebug.ini) file first. If it looks ok ala this discussion, then check that you're not having networking issues.
I don't know this means to you anymore or not! But, did you hit to a PHP file (anything.php) with right debug parameter, something like XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=12882809194391.
People often make mistakes to hit a HTML file with the debug parameters which causes Eclipse to hang at xdebug session
I had a similar problem and it turned out I was using the wrong dll. Hope that helps someone in the future.
I had the same symptom. However, my problem was that I set
xdebug.remote_host = ""
I did this because I'm using apache virtual hosts to eliminate the need for localhost. However, I had change it back to
xdebug.remote_host = "localhost"
and then change my apache/etc/hpppd-vhosts.conf to have localhost point to my root c:\web.
For me, these symptoms were caused by the windows firewall (Win7 Pro). I needed to explicitly allow eclipse to pass the firewall. I did this via the dialog at "Control Panel\All Control Panel Items\Windows Firewall\Allowed Programs".
It might not be useful to everybody, but... when trying to debug remote hosts, always remember the DSL router! (or any router along the way) I spent hours trying to find a solution, when I noticed that all I had to do was to activate port forwarding (port 9000) on my Linksys and everything worked like a charm :)
The above inputs were useful. I checked xdebug parameter values in phpInfo() and found that despite my settings to 1 or On, auto_trace and remote_enable were off. So i made it to true. And then remote worked!. Thanks.
Note, now you can launch the remote debugging session from within Eclipse by configuring various Debug configurations OR/and whenever you launch your such configured application outside Eclipse, you will get a question at Eclipse to accept or not to accept the debug session. So if you are on a different machine than of the eclipse UI you might find that the call to your application is getting timed out for no reason. Actually there would be a yes - no dialog box wherever the Eclipse session is
This thread helped me sort out my issue with MAMP on OSX with Eclipse. After upgrading to MAMP 2.1.1 from the 1.x release, I was not able to get xdebug to work in eclipse. It was hanging at the 57% level.
phpinfo showed that xdebug extension was loading fine and there were no errors in the PHP or Apache logs.
I only wanted to debug locally but the reason for the issue was that remote debugging was not enabled. Adding xdebug.remote_enable=true to the MAMP PHP.ini template and restarting MAMP solved the issue.
In my case CLI application was working fine, but it was the web application which was getting stuck at 57%.
It worked after 2 changes:
made server debugger as XDebug
Auto Generate URL true.
If Netweaver/Eclipse fails to connect to XDebug, you may wish to check the Apache logs for occurrences of something like: Cannot load Xdebug - it was built with configuration API220090626,TS,VC6, whereas running engine is API220090626,TS,VC9
[Fri Jun 01 18:38:05 2012] [notice] Child 3404: Child process is running
To remedy this, pick the right version of the XDebug binary from the XDebug website (try a few combinations till you get it working)
Before eclipse setting, Check out the following content is visible in phpinfo function.
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
I too encountered the same problem. I double checked all the settings in php with the output of phpinfo() and everything was fine.
Allowing Java(TM) Platform SE binary through the firewall did the trick.
Check out the commands from this question, they are very useful for debugging!
I've tried every possible solution on this post to get xdebug to work on a site running on Apache (http port 8000) to no avail. I then accidentally noticed that xdebug was working on another site that I had running on port 80. As soon as I changed the other site to port 80, it finally allowed me to debug it.
I wonder if there's a setting that can direct Apache to allow xdebug on other ports than just 80. I have more than one site running in Apache and would like to debug each of them without having to reconfigure the ports. Anyone had this issue before? or knows how to fix it?
If your configuration is ok, just delete the file :
YOUR_WORKSPACE/.metadata/.plugins/org.eclipse.core.resources/.root/.markers
Had same issue using Uniserver Zero XIII 13.2.0 (requires MS VC12 redistributable install) and Eclipse Neon Release Candidate 3(4.6.ORC3). Our website uses phalcon, when we found an issue with the phalcon.dll and php7.0 we dropped back to php5.6. We verified xdebug settings above, added zend_extension=$(US_ROOTF)/php56/extensions/php_xdebug.dll--would not connect, no break points.
Found a warning at top of Eclipse Dialog Project | Properties | PHP | Debug | Configure Workspace Settings... | PHP Executables | PHP56(Workspace Default) | Edit | Debugger | "XDebug extension is not installed. Please visit http://xdebug.org...". This made us suspicious of the version of the php_xdebug.dll (2.5.0) in the Uniserver 13.2.0 php56. I downloaded php_xdebug-2.4.1-vc11.dll, dropped it in /php56/extensions and PRESTO! Eclipse PHP Debugger works!
Here is another blog which mentions how to verify if Xdebug is properly installed or not via the command line
http://allcodeverything.blogspot.com/2012/07/code-debugging-with-xdebug-and-eclipse.html
It mentions this
If you want to figure out if everything worked well, here is a nice piece of code that you'll run through the CLI (command-line interpreter, basically outside of Apache or a browser; just pure PHP) after you have typed the following in your browser: "http://localhost/dbgtest.php?XDEBUG_SESSION_START=ceable"
<?php
$address = "localhost";
$xdebug_port = 9000;
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, $address, $xdebug_port) or die('Unable to bind');
socket_listen($sock);
$debug_client = socket_accept($sock);
echo "connection established: $debug_client";
socket_close($debug_client);
socket_close($sock);
?>
The command-line window should print something like "connection established: Resource id #5".
I'm having this weird problem. All my settings used to work OK, until I updated my version of PHP. I use macports and have the php5 and php5-xdebug ports installed.
xdebug is working, but it is stopping on the first line of my script even though I have the option disabled in PhpStorm. There is no breakpoint there, and breakpoints in other parts of the code are working OK.
If it helps, here is the xdebug portion of phpinfo (in two parts);
https://dzwonsemrish7.cloudfront.net/items/3K3R2N1f1A190K372n0S/Screen%20shot%202011-08-18%20at%203.06.29%20PM.png?v=54c8964d, https://dzwonsemrish7.cloudfront.net/items/0i133s0U430k3u3w3B1E/Screen%20shot%202011-08-17%20at%205.14.25%20PM.png?v=1278da84 and the proof it is disabled in phpStorm: https://dzwonsemrish7.cloudfront.net/items/3W2S060I1b0W1q0z0c45/Screen%20shot%202011-08-18%20at%203.07.00%20PM.png?v=85471026
Is there an xdebug setting I need to change? When I did the upgrade, I lost my php.ini that had some other xdebug configuration.
The above didn't work for me because as far as I can tell if you're using Xdebug the only debug bookmarklets you get is start/stop and debug this page. I don't see any bookmarklet specific to stopping on first line, and neither the start/stop bookmarklets nor stopping PHPStorm from listening within PHPStorm fixed the problem for me.
To get it to stop I did this (on OS X):
Go to Preferences > Languages & Frameworks > PHP > Debug
Uncheck both of the 'force break at the first line...' options
Apply and close
In the Run menu, uncheck 'Break at the first line in PHP scripts'
For example, even if you have Path-Mappings, the public/index.php path may not be considered as part of the project.
Check the "Force break at the first line..." in the PHP->Debug section of preferences.
BESIDES THAT, also check this setting:
My problem with PHPStorm was that I was doing Drupal and the index.php was outside the project (since the project is a module). I needed to uncheck the settings "Force break at the first line..." in the PHP->Debug section of preferences.
Do you use debug bookmarklets? 'Break at the first line' option could be also controlled via 'xdebug Break On' and 'xdebug Break Off' bookmarklets.
Im trying to configure xdebug to work with Netbeans 6.9 and php 5.3
As far as i concern i have setup xdebug properly.
I can see xdebug extension from phpinfo page.
I have read other post and tried their suggestion but up to no avail
When i hit the debug button, it straight open the page in the browser and i can see message 'Waiting for connection' in the bottom pane of netbeans
Here my setting in php.ini
zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
Any help would be appreciated
First, check that it isn't actually working for you, and you don't notice. I've done this...convinced it's not working I wasted a chunk of time trying to get it to work, only to find that everything was OK.
Look at your NetBeans status bar. If you see "netbeans-xdebug" and "running" then it is actually working just fine. You probably have the "Stop at first line" option turned off and you didn't hit any breakpoints you set (if any) yet. That would be a reason you are seeing the page with little or no indication that the debugger is actually connected.
If you instead see "Waiting for Connection (netbeans-xdebug)" and the progress bar is cycling, then you are indeed not connected. Open Tools|Options, and go to the PHP page. On the general tab, make sure that the "Debugger port" is 9000 and the "Session ID" is "netbeans-xdebug". You may want to have "Stop at First Line" checked. I don't, as I find it a bit annoying. I would definitely ensure that "Watches and Balloon Evaluation" is not checked. This option causes NetBeans and the debugger to destabilize. If you need a watch, hack a local variable into the PHP code where you need it, and you'll see it on the "Variables" tab when the debugger is running. Also, confirm that file (index.php) is specified in the project's Run Configuration > Index File.
Since you see xdebug in phpinfo(), that end of it is fine. Just make sure that all of the values look reasonable, and that there is some reference to a cookie "XDEBUG_SESSION=netbeans-xdebug" somewhere on that page. (Make sure that you don't have cookies turned off on the browser!)
The only other thing to check is to see if some firewall/security program is running that would be blocking TCP/UDP locally (which would be super-odd, but not out of the realm of possibility), or that port 9000 isn't already used by another application. I am using a different port number in my local setup for some reason. I don't remember changing it, but I am sure that the only reason I would have is if I had hit a port conflict with something else.
One last thing... We've been assuming that you are running NetBeans and the web server on the same computer. That's a common configuration, but not the only one. If your web server is on a different computer, then change the localhost in xdebug.remote_host=localhost to the IP address of the computer on which NetBeans is running.
Another last thing: When cycling through frustrating iterations, until you see xdebug info in phpinfo(), restart apache/php. Once there, still restart NetBeans between iterations. And believe it or not, restart your browser.
For me it was changing
;xdebug.remote_enable = 0 (default value in clean XAMPP installation)
to
xdebug.remote_enable = 1
did the trick
Adding an index.php did the trick for me.
I couldn't figure out why some of my projects would connect to the debugger and others wouldn't. Then I realized that the ones that wouldn't connect started with index.html. Once I renamed these files to index.php, the debugger connected with no problem.
I solved this using a windows -> remote LAMP server config after reading the following post, leaving the link in case anyone finds it handy:
http://stuporglue.org/setting-up-xdebug-with-netbeans-on-windows-with-a-remote-apache-server/comment-page-1/#comment-6227
Having just upgraded to the new Ubuntu 14.4 my NetBeans Xdebug stopped working. I've followed all the answers above to date to no avail.
I found a NetBeans Ubuntu statement that the /etc/php5/cli/conf.d/xdebug.ini file should have xdebug.remote_enable=on. When I checked the /etc/php5/cli/conf.d directory, I found no xdebug.ini file. However there was a link to /etc/php5/mods-available/xdebug.ini there.
Subsequent adding the xdebug.remote_enable=on to that file fixed the problem.
PS - This works on NetBeans 8.0.1
When I tried to debug the Yeoman WebApps powered by PHP backend in Netbeans, the status keep showing 'Waiting for connection'. There's probably because the index.html has nothing to do with php at all. It's only when I've triggered the ajax which needed PHP processing, the connection with xdebug immediately connected and debug as usual. Hope this give another perspective to someone as I have stumbled to 'think' there is a problem and trying to fix the ini.
An alternative is the Dephpugger project. Is like ipdb in python or byebug in Ruby.
https://github.com/tacnoman/dephpugger
Is very easy to use.