I'm trying to configure XAMPP to debug. I've got the Xdebug dll from the site with my PHP version and put it in my ext fold, but when I change the php.ini with the next code and restart Apache, the localhost link stops working.
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-3.1.0-8.0-vs16-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
Someone who can help me here and ho to configure VSCode.
Following the official documentation I wanted to run Xdebug in "jit" mode. But not working. When I add configuration to my php.ini file then everything works but every request (even when Xdebug listener in PhpStorm is off) takes long (5s to 0.5s when Xdebug is off in php.ini).
So I wanted to make it in "jit" mode or "on demand" but both are not working.
I'm using Windows 8.1 and XAMPP.
This is my config:
The minimum config that works for me in WAMPServer & Netbeans is
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
I see you are configuring for the CLI, so check that the php.ini file you have changed is the one used by the CLI.
You can check that by doing this from the command line
>php --ini
then check the Loaded Configuration File to make sure you edited the right file
UPDATE
You also must uncomment, delete the leading ;, from the zend_extension line
zend_extension="c:/xampp/php/ext/php_xdebug-2.9.5-7.4-vc15-x86_64.dll"
I installed PhpStorm and Xdebug. When I'm trying to debug in a PhpStorm, not on a web page the debugger doesn't work.
I added the following code in php.ini
[Xdebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.8.0-7.2-vc15.dll"
xdebug.remote_enable = 1
I also downloaded "php_xdebug-2.8.0-7.2-vc15.dll" and put it in C:\xampp\php\ext folder.
Unable to enable XDEBUG. Any help or check if it is enabled and not reflected? I am on PHP7 and am using Xdebug 2.4.0rc2. PHP.INI settings below:
[XDebug]
zend_extension="C:/php/ext/php_xdebug.dll"
xdebug.remote_enable = on
xdebug.remote_host = localhost
xdebug.remote_port = 10000
xdebug.remote_handler = dbgp
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "profilerlogs"
xdebug.profiler_output_name = cachegrind.out.%p
Unable to get it enabled. The steps are right but doesnt show up installed in phpinfo() as well.
I had same problem with XAMPP PHP7 now it's solved :)
There should be missing or wrong extention file in your C:/php/ext/ directory.
This will solve your problem.
Go to xDebug
Dowload Xdebug 2.4.0rc1 (PHP 7.0 VC14 TS 32/64)
Rename it to php_xdebug.dll
Paste this file in "php/ext" folder
Restart your server.
Now check your phpinfo()
In my case there were 64bit version so I've just changed to 32bit
Along with what #haider-lasani said please do not forget what type of PHP you are using. The latest XAMPP is using some really convoluted setup.
Go to your PHP folder and check whether you have php7.dll or php7ts.dll. If you have the latter version then you are supposed to pick up the TS version of xdebug.
Also check VC version as well.In this case it is VC14.
Now even though I am using a TS version of PHP I still have to add the plugin with zend_extension="C:/php/ext/php_xdebug.dll" and not zend_extension_ts="C:/php/ext/php_xdebug.dll"
TL;DR
While downloading xdebug make sure you:
Check x64/x86 bit version.(Use x86 xdebug just to be safe)
Check what version of PHP you are using.
Check whether you have TS or non-TS version of PHP by checking whether you have php{x}.dll or php{x}ts.dll.{x}is your php version.
Try switching between zend_extension and zend_extension_ts to include your xdebug plugin in your php.ini file to see what works.
Following all these steps should ideally fix your problems. Let me know if you still are facing any problems. Peace.
You shouldn't need to rename your DLL and it is a good idea not to, as it allows you to see what build of XDebug you have running.
Here is what I did and it works:
This answer assumes you have PHP set up with the correct PATH entry so that you can run PHP from the Command Line such as GitBash https://git-for-windows.github.io/
Open up your command line and enter this:
$ php -i
Scroll to the top and copy the output from the command line window beginning where you see
phpinfo()
..... copy contents until you see the last line which ends:
If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license#php.net.
`
Go the XDebug Windows Wizard https://xdebug.org/wizard.php and paste your PHPInfo in the big text box and submit.
A new page will display with instructions and a "System Summary of your PHP. Carefully follow the instructions and select the Download link.
Once you have modified your PHP.ini and observed where your "ext" folder is, copy your downloaded XDebug dll file to "ext" folder.
Open your command line again and enter the following command:
$ php -m
If you have correctly followed the instructions you will see the output contains the following:
[Zend Modules]
Xdebug
Otherwise, you will see an error at the top of the console output such as:
Cannot load Xdebug
Usually, the errors occur because your XDebug:
is not in the correct location
is the wrong version
is incompatible because of thread type: Your PHP maybe Thread Safe, and your XDebug is Not Thread Safe (the XDebug Wizard will automatically choose the correct version)
If you are doing remote development on either a WSL or a Linux, check your php directory as you may need to modify php.ini files in the following locations:
/etc/php/7.2/apache2/php.ini
and
/etc/php/7.2/cli/php.ini
with
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
;don't forget to change the path and filename to the correct one
;but make sure you use the full path
zend_extension="/usr/local/php/modules/xdebug.so"
I installed Xampp like a week ago. It was already installed with a php_xdebug.dll file in the ext folder.
For me the solution was to specify the xdebug file like below, without a file path:
zend_extension = "php_xdebug.dll"
If you're on Windows 10 x64 running PHP 7.2 and Apache 2.4, Specifying DLL without the full path like this
zend_extension = php_xdebug-2.8.0-7.2-vc15-x86_64.dll
worked for me because my extension_dir = "ext" was set properly in php.ini.
Here is a detail set of instructions if you're using similar setup.
My netbeans does not work the breakpoints using xdebug, my configuration looks correct, so I configured the first time I ran up to stop debugging the first time since then has never worked, someone had this problem? The version of my netbeans is 6.8 and the version of php is 2.5.2.
my php.ini:
zend_extension_ts = d:\wamp\bin\php\php5.2.5\ext\php_xdebug-2.0.2-5.2.5.dll
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=netbeans-xdebug
xdebug.profiler_enable=1
In my case this line needed to be included in the php.ini:
xdebug.remote_autostart=on
Here is the configuration section for XDebug:
[xdebug]
xdebug.remote_enable = on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
xdebug.remote_autostart=on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "d:/wamp/tmp"
Checklist for xdebug:
Check that xdebug is loaded in phpinfo(), and the runtime value matches expected configuration.
xdebug.remote_enable is on.
xdebug.extended_info should be on for breakpoints to work.
xdebug.remote_port must be same as ide and unused.
xdebug.remote_handler is dbgp.
xdebug.idekey should be set to same as ide's key if xdebug.remote_autostart is on.
Sometimes it help to set xdebug.remote_host to intranet IP or computer name instead of local ip 127.0.0.1. PHP must be allowed by Firewall to connect to this host and port.
Setting xdebug.remote_log to a file will help in checking what is wrong. Disable the log once debug is working.
Sample config:
[xdebug]
xdebug.extended_info=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=on
xdebug.idekey="netbeans-xdebug"
Checklist for NetBeans:
Firewall must allow Netbeans to listen for connection with configured host.
Tools -> Options -> PHP -> Debugging, check port. Also check session id if xdebug.remote_autostart is on.
Project type must be PHP.
Project Properties -> Source, web root must be correct.
Project Properties -> Run Configuration, index file need to be a php (or empty) for Ctrl+F5 to work.
Project Properties -> Run Configuration -> Advanced, debug url should be "Default" or "Ask Everytime".
Project Properties -> Run Configuration -> Advanced, path mapping must be correct. (e.g. empty if there are no mappings)
(Most default options work out of the box, so if you are desperate try to delete and recreate the project.)
False Instructions, tested on PHP 5.5 and xdebug 2.2:
PHP output_buffering does not need to be off. (But may help in debugging)
OPCache (Zend Cache) module can be loaded.
xdebug.profiler_enable can be enabled.
Please edit this answer if you found something new.
Check that you have the right version of Xdebug for your version of PHP (including Thread-safe/non-thread-safe and 64bit/32bit).
In some newer versions of PHP, you need to use zend_extension, not zend_extension_ts, regardless of whether you have the TS version of Xdebug.
(I am replying with an Answer since the formatting in comments wasn't working properly)
Same happened for me: worked once and then stopped. However, I reached a point in my config where it started working without problems and I can share.
First I moved on top of php.ini the ioncube loader:
[PHP]
zend_extension=/Applications/MAMP/bin/php5/zend/lib/ioncube_loader_dar_5.2.so
Then I put these lines in the xdebug config:
[xdebug]
zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
And commented out all the lines about Zend Optimizer
[Zend]
;zend_optimizer.optimization_level=15
;zend_extension_manager.optimizer=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.3
;zend_optimizer.version=3.3.3
I work on MAMP, this is why the paths to my libraries are referred to my MAMP folder.
Good luck
zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.3-5.4-vc9.dll"xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp"xdebug.remote_host = "localhost" xdebug.remote_port="9000" xdebug.remote_mode=req xdebug.trace_output_dir = "C:\xampp\tmp" xdebug.idekey="netbeans-xdebug"
this is working for me..
Here's how I was able to get it to work w/ mulitple PHP-FPM homebrew installations.
I used this excellent article for the multiple installations:
https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew
In the comments of that post you'll see recommended how to install xdebug, bottom line:
brew install php56-xdebug
You have to install xdebug for each verions of PHP you have installed. Homebrew will make a xdebug.ini file for each version of php you installed. Each will have a path like:
/usr/local/etc/php/<version # i.e. "5.6">/conf.d/ext-xdebug.ini
This article installs DNSMasq which runs on xdebug's default port (9000), so you'll need to change the xdebug port to something else (9001 works fine.)
Edit the above mentioned ext-xdebug.ini file (or files if you installed more than one version of php.) Here's what works for me:
[xdebug]
zend_extension="/usr/local/opt/php56-xdebug/xdebug.so"
; General config
; Dumps local variables on exception
xdebug.show_local_vars=On
; Dump server variables
xdebug.dump.SERVER=*
; Dump global variables
xdebug.dump_globals=On
xdebug.collect_params=4;
; Tracing
;xdebug.auto_trace=On
;xdebug.trace_output_dir= /opt/local/php_traces/
xdebug.show_mem_delta=On
xdebug.collect_return=On
; Debugging. You might need to specify your host with some additional options
xdebug.remote_enable=1
: from http://devzone.zend.com/1147/debugging-php-applications-with-xdebug/
xdebug.remote_host="localhost"
xdebug.remote_port=9001
xdebug.remote_handler="dbgp"
The first two lines are all that is in the original homebrew file.
BTW - when I installed multiple PHP versions, this ext-xdebug.ini file was only created for the first PHP version I installed. I simply copied this file to the other PHP version locations, and changed the "php56-xdebug" part of the path in line 2 to reflect the proper php version.
Notice "xdebug.remote_port=9001"
Then in Netbeans (I'm using 8.02 Mac osX10.10.3) I use the following settings.
Go to Preferences->PHP->Debugging
Debugger Port: 9001
Stop at First Line: (unchecked)
Watches & Balloon Evaluation: (checked - there's a warning but it works fine for me.)
Also worth noticing is that in order for xdebug to show up using phpinfo() (or command line php -i) I need to restart apache with:
launchctl unload -Fw ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
sudo apachectl restart
launchctl load -Fw ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
For some reason my setup requires me to run this every time I startup. Kind of a pain, but I incorporated it in a shell command to easily switch between versions.
One more hint: part of brew info php56 says:
OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using
the brew version you need to make sure /usr/local/sbin is before /usr/sbin
in your PATH:
PATH="/usr/local/sbin:$PATH"
Until I added this to my .profile_bash file, changes I made to each version's php-fpm.conf file were not recognized. Everything else seemed to work so it was confusing.
Hope this saves someone else time & trouble.
If you are still stuck you could try the following:
Download a new version of xdebug via the wizard (http://www.xdebug.org/wizard.php) and if you follow the instructions maybe you will be lucky.
Switching off the firewall might help.
Use a different port in netbeans, for instance in my case using 9001 in netbeans and 9000 in xdebug worked.
Add to php.ini file: xdebug.idekey=netbeans-xdebug.
Find out if you have a xdebug.ini file and add the xdebug related php.ini lines to that file.
Always make sure that you restart your apache service to test everything.
In my case - host is on another server, Net-beans 11 - I need to open terminal to remotehost
Window -> IDE Tools -> Terminal -> Remote Terminal
P.S. If u type export XDEBUG_CONFIG="idekey=netbeans-xdebug" in that terminal, and start debugging session, u can debug console scripts