I trying install Xdebug on PhpStorm + OpenServer. Everywhere php v7.2. I tried several times to install different version of Xdebug.
There are my settings:
Also have Xdebug helper in Chrome, but variables still doesn't display.
If I enable break at first line flag, phpstorm show me this, but if I press "step into" it disappears.
I had the same issue with console application. Try insert somewhere before function you watching:
ini_set('xdebug.collect_vars', 1)
Or execute it in evaluation window.
Related
I am new to php and I need to use Xdebug with netbeans for a remote school purpose.
My php's version is 7.3.21 and I am using it with Wamp. Netbeans is on 11.1 version.
I installed last updates for wamp and xdebug, and the problem is when i run debugger in netbeans, xdebug doesn't load and keeps this status running :
So I investigated and xdebug seems installed as you can see here (from click on wamp -> php -> configuration) :
and here (from click on wamp -> php -> extensions) :
Everything seems ok, but still doesn't work. So I check on https://xdebug.org/wizard with phpinfo() function, pasted the return in the textarea and here's the status :
I check everything and here is my php.ini file :
In this context, using the debugger shows me infos on a html page as you can see on following image but I can't inspect my variables in netbeans because of the "waiting for connection (netbeans-xdebug)...
I tried to use "localhost" instead of my IPv4 address, and "ext" instead of "zend_ext" but the html page doesn't provide me anymore informations.
Moreover the weird thing is that when I copy-paste a php -i result in the textarea from https://xdebug.org/wizard, it tells me that xdebug isn't installed .....
I checked and tried many posts' solutions from stackoverflow, but nothing is working, I don't know what to do more, so if any of you guys could help me it would be highly appreciated.
Thank you
Edit: Thank you Arsen for the answer, I tried both of your suggestions and followed the upgrade guide but none is working . Here is my php.ini file which I modified that much that I can't even get back to the base configuration..
Should uninstall wamp and install it again ?
I have a 5.6.40 php version and the preinstalled xdebug 2.5 version is working in netbeans.
The problem is that I will have to modify an app written with php 7 and use phpUnit / phpDocumentor / codeSniffer. Do you think that working with e 5.6.40 php version would be fine ?
Again, I am new to php / wamp and all the related stuff, sorry if my questions are "stupid".
XDebug 3 is still pretty new and it appears your xdebug-configuration in your ini-file is still using the config names for XDebug 2. Luckily, XDebug provides a upgrade guide, which you should adjust your config according to.
My first guess is that you are using the wrong port, because XDebug 3 is using port 9003 by default and you are expecting port 9000 in NetBeans.
So you can either:
Listen on port 9003 in NetBeans or
Set xdebug.client_port to 9000 in your ini-file. (Rather than xdebug.remote_port, see the upgrade guide Ilinked above)
Keep in mind that you should go through the upgrade guide for all your configuration settings to ensure that XDebug is actually doing what you want it to.
I have properly running xdebug on vagrant on my local pc on Ubuntu. It shows its orange table with error info. My testing page is localhost:8030
In Chrome browser I have Xdebug helper.
The problem is that an annoying warning is displaying in PhpStorm each time I refresh the site:
Debug session was finished without being paused
It may be caused by
path mappings misconfiguration or not synchronized local and remote
projects.
To figure out the problem check path mappings
configuration for 'localhost' server at PHP | Servers or enable Break at
first line in PHP scripts option (from Run menu).
I have checked path mappings configuration for 'localhost' server at "PHP | Servers" and they are OK. My PhpStorm project directory is associated to default Vagrant directory /vagrant/web/.
Enabling Break at first line in PHP scripts option does help but it is kind of an opportunism I think.
How to get rid of these PhpStorm warnings?
For PhpStorm 2021.1.1 +
[Ctrl] + [Alt] + S
Settings : Php -> Debug
Scroll to Advanced settings and expand
Uncheck option Notify if debug session was finished without being paused
It would do this if there are no breakpoints being hit when debugging the script. The "break at first line" probably prevents PhpStorm from issuing you the warning, but otherwise it does exactly the same.
In case you do have breakpoints configured, and PhpStorm doesn't stop on them, then it is likely that you have path mappings configured wrongly.
Using Xdebug's xdebug.remote_log=/tmp/xdebug.log setting/feature to see which breakpoints PhpStorm tries to set, and see whether it does so for the correct paths. They will up as breakpoint_set commands in the log file.
This feels like a really stupid question, but I cannot find any YouTube videos / articles / guides / etc that explain the debugging process in Aptana.
I've found the ones that explain how to install the XDEBUG or ZEND components, and that's all good. Now, how do I use them? I can see all sorts of menus, server configurations, debug configurations, but I cannot find a guide that explains how to actually set about using them.
Is there some sort of "PHP debugging with Aptana for dummies" that would provide a very direct walkthrough, something along the lines of:
This guide starts by assuming you have installed XDEBUG into your Aptana studio, and confirmed it with phpinfo().
Setup a debug configuration by....
Start your debugger by ....
Step through the code by ....
and so on.
It sounds so obvious, but I cannot even find something like that for a different IDE.
Please someone put me out of my misery.
Hope this helps someone... heaven alone knows why I've battled so much with it.
I am using Aptana Studio 3, build 3.4.2.....
And XAMPP ver 1.8.1 installed on C:\xampp (on a windows machine)
1. Ensure that XDEBUG is PROPERLY installed.
I moved to a new computer, and forgot to check. :(
Open php.ini file under \php directory
Make sure the following lines are uncommented (no semicolon)
zend_extension="<Xampp_Home>\php\ext\php_xdebug.dll"
xdebug.remote_host=localhost (change 'localhost' to '127.0.0.1')
xdebug.remote_enable=0 (change '0' to '1')
xdebug.remote_handler="dbgp"
xdebug.remote_port=9000
Save and restart web server.
2. Setup your web server in Aptana under Window > Preferences > Aptana Web Studio > Web Servers.
(I use virtual host containers.)
Name: MyWebServer
URL: http://MyProject
DocumentRoot: c:\xamppProjects\MyProject\php
3. Setup the PHP interpreter in Aptana under Window > Preferences >
Aptana Web Studio > Editors > PHP > PHP Interpreters.
Add...
Name: XAMPP PHP Debugging
Executable path: C:\xampp\php\php.exe
PHP ini file: C:\xampp\php\php.ini
PHP Debugger: XDebug
Now try it out
In Aptana Studio, select the Debug perspective.
Open a browser and fire up your app (http://MyProject)
Aptana interrupts with a pop window titled "Incoming JIT debug request" and asks "A remote debug request was received from 'MyProject'. Would you like to break on the first line?"
Select yes, and you're into the debugging.
Once I got to this point, I found the setting of breakpoints and tracing the flow pretty painless.
I am running Zend Server 5.6.0 which is PHP 5.4 and I am using PhpStorm 5.0. I am looking to put some profiling and debugging in place.
I have configured everything that I can see in PhpStorm, when I run the debug from the IDE it runs the script, then displays Connection with 'Zend Debugger' was not established. Validate Installation.
I have installed the toolbar but whenever I try to debug a page in Firefox it actually pops up with a download window and the file downloads, when opened it displays a server error.
All of the help guides online dont seem to work, has anyone else has these issues?
I ended up using Xdebug:
To Install Xdebug:
Go to webpage.
Paste your phpinfo() contents into the box
Follow the instructions on the wizard page except for where it tells you to add zend_extension = C:\Zend\ZendServer\lib\phpext\php_xdebug-2.2.1-5.4-vc9-nts.dll to the top!, put this below the iOnCube Loader (if you have it installed)
Add the following to php.ini then restart PHP & Apache.
php.ini
[XDebug]
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.profiler_enable=0
xdebug.profiler_output_dir="C:\Zend\ZendServer\tmp\xdebug-profiler"
Xdebug in PhpStorm
Generate and add bookmarklets to your browser here (Note the IDE key ##PHPSTORM##)
Open File -> Settings -> PHP
Choose your interpreter
Click [..]and choose Debugger: Xdebug
Click the "Configurations" then Edit Configurations... item (Drop down next to debug button on toolbar)
Press the [+] to add a configuration and choose PHP Remote Debug
Call it Xdebug and use the IDE key PHPSTORM
You can now start the debugger (Alt+Shift+F9)
Start the debugger using the bookmarklet
You can now stop through code in PhpStorm, hope this helps someone
This is happening because PHPStorm is using the binary for php found under /usr/bin this is not the same one as Zend Server uses under /usr/local/zend/bin. On some systems like Mac PHP is already installed by default under /usr/bin but it will not interact with the Zend Server/Debugger.
To fix this all you have to do is go into the PHPStorm preferences and tell it to use the proper Interpreter. Click the ... button next to the Interpreter drop down and give it the path to zend's bin directory /usr/local/zend/bin
This solved the issue with PHPStorm debugging with the Zend Debugger.
I have both xdebug and Code Sniffer working great on my installation of PHPStorm, but the one really annoying part is that the debugger now seems to be treating Code Sniffer errors as breakpoints and interrupts the code to let me know of style warnings while I'm trying to test out code. What can I do to prevent Code Sniffer from being caught by the remote debugger in PHPStorm?
PS: I'm running Apache, using virtual hosts to map certain URLs to folders on my computer, and code sniffer never triggered PHPStorm's remote debugger explicitly, while my site caused PHPStorm to ask me if I wanted to include it's virtual URL for debugging.
I had a similar problem and I solved it like this:
- went to "Project settings" -> "PHP" -> "Debug"
- under "XDebug" I unchecked the two "Force ..." options.
Hope it does the trick for you.
I have added "-dxdebug.remote_enable=0" argument in last line of phpcs.bat and phpcbf.bat.
"%PHPBIN%" -dxdebug.remote_enable=0 "%~dp0\phpcbf" %*