Installing XDebug on Windows + XAMPP + VSCode
So i'm not the most proficient PHP guy out there. In fact i have been a .NET developer most of my life. Being so i am so used to having a formidable debugger at my disposal as we were raised on Visual Studio which has excellent debugging capabilities.
Because of that fact the first thing i wanted to setup when i was handed a PHP project was setting up Debugging ! I asked some of friends and most of them were using some sort of printing mechanism but no , your boi gaba does not get down like that so i decided to setup debugging and ended up going for XDEBUG which i absolutely loved! My setup was Windows 10 + XAMPP + VSCode as the IDE ,working on a Laravel project.
So when i first setup XDEBUG on my machine , i followed this great article which taught me how to set things up. After setting up i used and enjoyed XDEBUG to the fullest for about a year on my machine. Then today , i had to transfer to a new computer so i decided to set up my beloved XDEBUG on my new machine. I did the exact same steps i did before , but alas ! Despite XDEBUG module getting enabled on PHP , i was unable to load localhost! localhots was unreachable with XDEBUG enabled , but worked when you disable it form php.ini.
I ripped the hair out of my head tried to find a solution for this all day but failed miserably , having tried all the remedies i could find online. But then finally , i figured out what was happening!
Because of that fact the first thing i wanted to setup when i was handed a PHP project was setting up Debugging ! I asked some of friends and most of them were using some sort of printing mechanism but no , your boi gaba does not get down like that so i decided to setup debugging and ended up going for XDEBUG which i absolutely loved! My setup was Windows 10 + XAMPP + VSCode as the IDE ,working on a Laravel project.
So when i first setup XDEBUG on my machine , i followed this great article which taught me how to set things up. After setting up i used and enjoyed XDEBUG to the fullest for about a year on my machine. Then today , i had to transfer to a new computer so i decided to set up my beloved XDEBUG on my new machine. I did the exact same steps i did before , but alas ! Despite XDEBUG module getting enabled on PHP , i was unable to load localhost! localhots was unreachable with XDEBUG enabled , but worked when you disable it form php.ini.
I ripped the hair out of my head tried to find a solution for this all day but failed miserably , having tried all the remedies i could find online. But then finally , i figured out what was happening!
- In my old machine i had php version 7.2.12
- In my new machine i have php version 7.4.3
- And for some reason , it seems that the latest php version includes XDEBUG out of the box ( or at least when you install it on Windows through XAMPP ). See below :
And this seemed to be the culprit who is messing it up !
So dear friends , with that finding let me tell you how you can get XDEBUG on without going through the same shit that i went through.
- Install XAMPP
- Check if you have php_xdebug.dll already there in C:\xampp\php\ext
- If you DO NOT have php_xdebug.dll , then you can follow the article i linked above. It will get the job done for you.
- If you ALREADY HAVE php_xdebug.dll , then you DO NOT HAVE TO download it again from xdebug website. Just go the same article i linked → skip step 1 at the very top → and continue with the rest. I added a screen shot so we are on the same page.
And that's it guys ! Winner winner chicken dinner , you got your debug working like a charm ! Enjoy!
BONUS:
Here's my php.ini file configuration section in case you want it.
zend_extension = "c:\xampp\php\ext\php_xdebug.dll"
;if you download through xdebug website your entry should look like this
;zend_extension = "c:\xampp\php\ext\php_xdebug-2.9.1-7.4-vc15-x86_64.dll"
xdebug.remote_autostart = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "c:\xampp\tmp"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log = "c:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "c:\xampp\tmp"
xdebug.remote_cookie_expire_time = 36000
Comments
Post a Comment