Xdebug and PhpStorm - Debugging not working - php

I am using PhpStorm.
PHP Version 7.2.7 and Xdebug version 2.6.1
I have change the port to 9001 instead of 9000 (because it is listening to TCP)
Not it is listening to port. I have put breakpoint. But still it is not debugging.
Is there any setting I am still missing?
In Debugger: it is showing to 'Connected to localhost:65451' and project is demo.local (virtual host)
In Run -> Stop Listening to PHP Debug connections already have

I cannot comment so I am adding what worked for me here.
I was struggling with this thing from quite some time and I installed this extensions
Xdebug helper
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc/related
and it works for me!
Basically check if your phpstorm configurations are all right.
https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html
Then I tried 3 plugins
JetBrains Toolbox Extension (didn't worked)
https://chrome.google.com/webstore/detail/jetbrains-toolbox-extensi/offnedcbhjldheanlbojaefbfbllddna
JetBrains IDE Support(had some problem communicating with phpstorm or didn't worked )
https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji
Xdebug helper (worked! yeeey )
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc/related
and that's it :D

Related

Eclipse PDT + PHP 8 + Xdebug 3 + Vagrant. Debugging is not working

I'm trying to make this setup work with no success for debugging. I have this Xdebug configuration in a Vagrant box with PHP 8 but I can't debug with Eclipse PDT... Can anybody help or point to the right direction?
The solution was setup xdebug.clienthost to my Windows Machine local network, where eclipse is installed. So I did vagrant ssh, then edit the 20-xdebug.ini located at
/etc/php(the version you are using)/fpm/conf.d and added the line
xdebug.client_host =192.168.1.49
notice that your xdebug.client_port must be 9003 also
of course this is my ip of my laptop in my local network you have to figure out yours and make it fixed if you are behind a dhcp router.
Then I did a vagrant reload.
Then in Eclipse I setup the xdebug preferences to listen the 9003 port, stop the first line and prompt for remote connection.
And in firefox I installed the xdebug helper and choose "debug" before loading the page.

Apache NetBeans 12.3 and XAMPP 3.2.4 PHP Breakpoints Windows 10

I spent a few days configuring the Apache NetBeans 12.3 and XAMPP 3.2.4 and PHP and I am not able to make it functional in way, that I will be able to debug the code with a breakpoints working.
I installed first new xampp make sure that is completely new installation.
Restart of pc needed so I did so.
Installed ApacheNetbeans 12.3 IDE
Checked the PHP.ini - first strange point. No [Xdebug] Were stated here.
I created new project in netbeans put phpinfo() inside run the page , page showed , copied the content , put it to setup wizard downloaded the dll , put dll to the certain place where they stated opened the php.ini ...
5.1 In php.ini no Xdebug was stated so at the end of the file I added [XDebug] and stated part of code.
5.2 I set up the port to 9000 (also 9001 in another attempt) and saved the php.ini with new values in.
6. Stopped the Apache, Stopped the mysql , turned off the Xampp , run xampp under admin rights , started the apache ,and started the mysql
7. NetBeans - opened the project, removed the phpinfo();
7.1 Added the lines: echo("Test"); $x = 1; echo("after Test");
7.2 Added breakpoint on $x=1;
Run in debug mode.
No breakpoint were catched. In netbeans there was a still message that stated: "Waiting for connection ..."
I am not sure what is here wrong , but I checked many other topics ( they are older than this one) and no solution worked. Is it still Apache netbeans and Xampp on windows 10 compatible ?
I know I was able to run and use it few years ago when it was not Apache NetBeans but just netbeans and I did not face that issue. Just installed both Xampp and Netbeans and no other special configuration were needed.
I turned off the firewall ,
checked if there is no zend tags in php.ini ,
checked if it installed it shows it is , and it is OK (shows versions) ,
changed ports to 9001 or different as was suggested in another threads ,
tested few different commands like xdebug.enable_remote = on , instead 1 and vice versa ...
after I clicked netbeans help which appears after I stopped debugging the link goes to not found page ...
I googled the wiki page of netbeans and proceed these steps as well ...
Did anyone face the same issue on clean install ? What is the solution for that or what I am doing wrong ?
Thanks so much .
Edit 17.5.2021 .
There is no antivirus installed and also windows firewall and defender is off .
Localhost can be loaded with page but no break points available.
Edit: Adding my log:
Xdebug installed: 3.0.4
Server API: Apache 2.0 Handler
Windows: yes
Compiler: MS VC15
Architecture: x64
Zend Server: no
PHP Version: 7.4.10
Zend API nr: 320190902
PHP API nr: 20190902
Debug Build: no
Thread Safe Build: yes
OPcache Loaded: no
Configuration File Path: no value
Configuration File: C:\xampp\php\php.ini
Extensions directory: C:\xampp\php\ext
NetBeans 12.3 and XAMPP 3.2.4 are compatible with win10.but if you pre installed antivirus software like avast or kaspaskey they will detect xampp as a malicious software.so before you run xampp turn off the antivirus software and try again.
First right click on your my computer icon & choose manage
then go to services and applications
select services
set windows defender startup type to manual instead of Automatic & restart the computer.and try again from installation xampp. you should try from xampp installation
If it does not work install a xampp old version and try again.
Sometimes windows defender detect it as a malicious software. So turn it off and try again.
There is no matter with netbeans ide.
If you getting problems with xampp every time install zend server or another WAMP software and continue work

Eclipse Aptana Studio 3, xdebug configuration for Windows with virtual machine

I have a problem to debug php files with Aptana Studio. I don't know is it possible to be done because the way of working is a little bit complicated.
Actually I have my source PHP files into my local Windows machine, also my Aptana studio. The Apache server has been installed on the Ubuntu virtual machine and has as source the files of my local Windows machine.
From the web browser into my local Windows I charge the URL of the virtual machine and I would like to debug from Eclipse/Aptana.
I have to configure Xdebug in Eclipse, but I don't find issues how to do in my case.
Is there someone having the same problem or idea ?
Finaly we found the solution for Eclipse PDT but the same is valid for Aptana just the eclipse configurations are a little bit different.
In order to implements the remote debug you must to install the xdebug packages where the virtual machine is (in our case the Ubuntu virtual machine).
After into the /etc/php/7.0/mods-available/xdebug.ini you must to configure the 2 lines :
xdebug.remote_enable=on
xdebug.remote_host=192.X.XX
where the remote_host is the IP of your local machine containg the eclipse.
Further you must to change the eclipse configuration Windows->Preference->PHP->Debug->Debuggers->Xdebug to put the debug port (same as in xdebug.ini file - default 9000), and set Accept remote session (JIT) to any.
For Aptana change the xdebug configuration by searching where Accept remote session (JIT) is.

Xdebug doesn't stop at break points in Symfony project

I'm using MAMP free version and PhpStorm
To enable Xdebug in MAMP I've modified 2 php.ini files accordingly to this tutorial:
/Applications/MAMP/conf/php5.6.10/php.ini
/Applications/MAMP/bin/php/php5.6.10/conf/php.ini
Now I'm able to use xdebug in some simple project by listening to PHP debug connections. However if I try to use it in Symfony project, xdebug just ignores break points.
Here is my configuration for Symfony project in PhpStorm:
UPD: Added screenshot of xdebug configuration
UPD2: Added path mappings
I recommend you to try chrome XDEBUG extension. It works fine for me
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc

Homestead 2 xdebug doesn't work

I have a Homestead vagrant VM setup. Xdebug is all setup for remote debugging out of the box.
I can see this in here /etc/php5/fpm/conf.d/20-xdebug.ini
and by doing a php -i | grep 'xdebug'
I've setup a breakpoint in my default index.php and clicked the 'start listening for PHP debug connections' in my IDE PHPstorm.
I have installed xdebug helper for chrome and turned it on, also setting my IDE string to PHPstorm in it's settings.
I've tried setting different ports in both my IDE and xdebug settings.
I've also tried listening to these ports with sudo nc -l 9002
on both host and guest machines, nothing connects so the problem here is definitely with xdebug settings in the PHP server.
Posting my own answer here for posterity in the hope it saves someone time as I trawled google for an answer and spent several hours stuck on this.
When doing a sudo netstat -taupen I saw HHVM was listening on port 9000 on the VM which should have been a clue to why it wasn't working, I set hhvm: false in my homestead.yaml to no avail.
After more fiddling I saw that phpinfo() was giving a message of 'HipHop', A quick look at Google again led me to HHVM.
What I didn't do before was reprovision my homestead which sometimes is needed when changing stuff in the config. So after a homestead provision HHVM was fully disabled and xdebug was working.
Also word of warning, editing xdebug settings in the ini requires a restart of php fpm, nginx alone is not enough. Do a sudo service php5-fpm restart.
Just a quick note I tried all of the above provided solutions
My Solution:
for PHP7, Laravel 5.3 and homestead
vagrant ssh
sudo apt-get purge hhvm && sudo service nginx restart
After purging hhvm from the system xDebug works as expected.
Description:
In newer versions of laravel/homestead hhvm is not supported anymore but is still running!
They took all descriptions out of the documentation. (Laravel 5.3)
hhvm: false in the Homestead.yml config does not work anymore!
Tried it in every possible location of the Homestead.yml file, but if you reprovision and boot up homestead the hhvm instance is still running and listening on port 9000...
First I tried to change xDebugs listening port to 9089 which did not work. (yes I restarted fpm)
At some point I got annoyed and purged hhvm from the homestead vm.
Now everything works as expected.
Note: The provisioning is not reinstalling it.
Hope this helps someone and thanks for pointing me into the right direction

Categories