By choosing Break at First line, the debugger gets active when entering each file, allowing me to step in and out of the code.
But it is a bit cumbersome having to tab your way through half a million steps to get to the point where it starts to get interesting.
My setup is WIMP Window 7, PHP 5.3
; xDebug config
zend_extension = "C:\Program Files (x86)\PHP\v5.3\ext\php_xdebug-2.2.1-5.3-vc9-nts.dll"
xdebug.remote_autostart=0;
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
I have made sure that the path mapping is correct.
But could it be because i'm linking to the PHP files from my Eclipse project?
After downloading Eclipse Juno i'm able to stop at breakpoints.
I have tried everything with Eclipse Indigo.
Version: 3.7.2
Build id: M20120208-0800
Just wont work, either with an internal or external browser.
Time to move on to Juno i guess?
Eclipse has an option to turn off "break at first line". Go to "Windows -> Preferences -> PHP -> Debug" and uncheck "Break at first line" and also to go in "Run > Debug Configurations > PHP Web Application" and unselect "Break at first line" in all the configurations. Then restart Eclipse.
For all those, that are still fighting with this problem, some handy tips.
Check which version (package) of Eclipse you have? It turns out, that Helios package has some bugs and doesn't stops on breakpoints, when you debug your application as Web Application. Debugging works only, if you run it as PHP Script. Which makes it pretty useless for debugging process.
You should consider either reverting to older Galileo Package Eclipse for PHP Developers or installing newest Eclipse Juno (or even newest developer version of Eclipse Kepler), which doesn't have PDT support build in, but you can easily add it to then, using Help > Install New Software.. (point it to http://download.eclipse.org/tools/pdt/updates/release).
These versions are reported to be able to debug as Web Application, respecting breakpoints.
Also, remember, that Xdebug must be run as Zend Extension in order to support breakpoints! In other words remove extension=xdebug.so (on Linux or xdebug.dll on Windows) line from your php.ini and replace it with zend_extension=/full/path/to/xdebug.so (on Linux or zend_extension=X:\full\path\to\xdebug.dll on Windows). Zend extensions requires full path, even if they're put into /php/ext folder, as regular PHP extensions. You'll find more info on this in Xdebug FAQ (look for an answer to "Xdebug is only loaded as PHP extension and not as a Zend Extension" question).
Here is a post describing how to get breakpoints to work with XDebug in Eclipse.
http://programmersjunk.blogspot.com/2013/05/eclipse-and-xdebug.html
Related
I have Ubuntu 18.04, XAMPP, PHP 7.3.0 and I tried installing XDEBUG using the XDEBUG wizard after pasting the output of my phpinfo() and added the location of xdebug.so in the php.ini file. But still php -m doesn't show XDEBUG. Can someone please help to figure this out? Let me know if anyone successfully implemented this with PHP 7.3 XAMPP and XDEBUG.
XDebug does fully support debugging for PHP 7.3 and XAMPP. I tested it just now again with the latest version of XDebug (2.7.1), PHP 7.3.0 and XAMPP.
At first, it didn't work for me either (except in my first line of code, but it didn't stop in other lines). It was similar to the problem discussed here which was caused by an old version of IDE. Updating my PhpStorm IDE fixed the problem (This problem and fix was only for PhpStorm IDE).
Therefore, if you are using PhpStorm, follow these steps:
Update your PhpStorm to the latest version. I updated it to 2019.1 version and it works fine.
Wait until indexing is done.
Enable accepting debugging, from the top-right button. Image
PS. You should add more details to your question, such as IDE, IDE version, what you have done already, and your debugging settings.
php -m is a terminal command. Be aware that sometimes CLI PHP will use a different ini file than that of your web server PHP.
So you can check which ini files were loaded with this command:
php -i | grep ini
Check you have XDebug installed by checking phpinfo() in your browser. If it is using a different ini, and you want xdebug available in the CLI, copy the ini settings from this one to the one the terminal told you.
Once you know, check the port in your IDE matches the settings the wizard gave you for your ini. PHPStorm for instance defaults to 9000, but if you use PHP-FPM then it uses 9000, meaning I had to make my debug port 9001 and change it in the IDE too.
Make sure the IDE is listening for incoming connections (PHPStorm has a little telephone type icon which will be either green or red)
Make sure you have set a breakpoint in your code. It's a good idea to try it on the first line. Just click to the left of the line of code next to the line number, and you should get a red spot indicating your breakpoint.
Finally, ensure you are sending the XDebug header with your request! I use a browser extension that allows me to enable/disable at the click of a button. Here's one for Chrome! https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en
So, I'm trying to configure PhpStorm to debug my application that's running on a Vagrant instance. I have some gaps in my knowledge as far as how this should work:
Q1: The VM's php interpreter and php.ini are being used and PhpStorm lists a version of xdebug next to them as the debugger being used (example: "Debugger:xdebug.(insert version)"). If it didn't think that php was set up to use xdebug, it would have listed "Debugger:none". phpinfo() also shows this same version of xdebug as the one being used. How is this possible when the php.ini file I'm using has no mention of xdebug anywhere? My understanding is that these two mechanisms (phpstorm debugger recognition and phpinfo()) use configuration to figure out what debugger I'm using. Could the xdebug reference be in another .ini file? I'm using php 7.
Q2: When I try and use PhpStorm's "Validate Debugger Configuration on Web Server" service it asks for a "Path to create validation script" and a "Url to validation script". What do these two fields mean and what values should I give them if I want to validate the Vagrant box's Debugger config?
Thanks for any input.
I have been trying to set up debugging using XDebug in Eclipse for the last few hours without success.
I have the following in my etc/php5/apache2/php.ini file
[XDebug]
xdebug.remote_enable=on
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_autostart=off
zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
The zend_extensions = /usr/lib...... was given to me by the custom installation instructions on the XDebug site. I followed the setup instructions exactly as they are on that page - http://xdebug.org/wizard.php
But from what I have read typing the command php -m should show XDebug twice, once under PHP modules and once under Zend modules. Well it is showing up under neither for me. So it seems that XDebug is not getting loaded at all?
Anyone any ideas on how to fix this problem and get XDebug working?
You've editted /etc/php5/apache2/php.ini file which is for apache. You'd want to edit /etc/php5/cli/php.ini for the command line interface's options.
If you pass in the phpinfo() from a web site, that PHP has run through Apache of course. And then the wizard will give you settings for the Apache set-up. If you would have passed the phpinfo() output (php -i) from the command line, it would have given you the settings for the CLI.
Something similar happened to me, the first time I setup xdebug in Eclipse it worked just fine, but the next time I tried it, it wasn't stopping at breakpoints. After a lot of research it turned out that I had 2 Eclipse instances running (one for Java and another for Php) and that caused some kind of issues with the debugger.
After closing both instances and starting Eclipse with php workspace first and then Eclipse with java workspace, xdebug worked fine again. My only idea is that debug port was already used when I tried to use it; or something like that.
An other common problem is that you use a router to get through INTERNET and that you had to forward XDEBUG PORT (generaly 9000) on your PC to make XDEBUG working with ECLIPSE.
But your router gives a dynamic IP to your PC and one day your mobile phone connects to the router before your PC and gets the IP address you configuredon you router IP FORWARDING !
The solution getting a static IP from your router. Here is an explanation: http://webologix.com/fr/blog/xdebug-eclipse-fonctionnement-aleatoire.html
I would like to know how i can get XDebug work with Aptana Studio 3 (I already have Aptana Studio 3 on this machine with XAMPP).
Do you know a recent article telling me how to do this and explains XDebug? I have no experience nor any knowledge about XDebug, i looked for articles but all seem outdated to me.
I realize that this is a old thread but I also had a difficult time finding out how to debug php with Aptana Studio and FireFox so here is a quick how-to to get it working...
The easiest way I found is to install wamp server V2.2, this is a very useful program as it installs Apache Server, PHP and MySQL and other tools, everything can be easily configured via the taskbar.
1.) Install Aptana Studio V3.3.X or higher Download here
2.) Install WampServer V2.2 or higher Download here (XAMMP users read bottom).
WampServer:
1.) Make sure XDebug is accepting remote debug, click on the WampServer icon in the taskbar and go to PHP->PHP Setting and make sure that "(XDebug): Remote debug" is checked if not select it click on the WampServer icon and "Restart all services".
2.) Verify that XDebug is running:
a.) If you had WampServer insert index.php enter "localhost" in the URL and under "Tools" click "phpinfo()" and check to make sure XDebug is running, you should see the following in FireFox:
b.) If you didn't overwrite the index.php create a file (/www_dir/phpinfo.php) with the following:
<?php
phpinfo();
?>
b.1) In FireFox enter "localhost/phpinfo.php" and look for XDebug as shown in the previous image.
Aptana Studio:
1.) Click Window->Preferences
2.) In the Preferences dialog go to Aptana Studio->Editors->PHP->PHP Interpreters
3.) Click "Add..."
4.) Enter the information like
5.) Click "OK"
6.) Click on the debug icon and select "Debug Configurations"
7.) Double click on "PHP Web Page"
8.) Click the plus next to "PHP Server"
a.) Enter a name
b.) Base URL will be "localhost"
c.) Document Root will be the path to your index.php
Finally in Aptana Studio click the Debug Icon Arrow and select the configuration you named above. If Firefox prompts you install the Aptana Studio plugin...
Hope this helps out...
-------------
XAMPP USERS
-------------
Follow the steps provided but your directory link in the
In the Preferences dialog go to Aptana Studio->Editors->PHP->PHP Interpreters
should link to C:\xampp\php\php.exe and C:\xampp\php\php.ini respectively
***** UPDATE *****
If you are using Firefox V20+ there are some compatibility problems with Firebug V1.8+ that basicly breaks Firefox's context menus, I could not find a fix for it so I ended up having to go another route and figured I should make a post, Aptana Studio is based on Eclipse so the best way IMHO to get PHP Debugging is to install Eclipse with PDT and remove Aptana Studio... The above instructions will work to get everything working with XDebug
Here is a nice link on how to get everything up and running eclipse-pdt
At the moment, there is no PHP debugger support in Aptana Studio 3. However, there will be soon. See: http://jira.appcelerator.org/browse/APSTUD-769 and add yourself as a watcher to get informed when it's done.
For now, you can install PDT from eclipse.org if you really need to debug.
They also provide up-to-date docs on how to use it. There is a small learning curve, but it will work pretty much the same in Aptana (once it's released), so you have nothing to lose :)
Here is a mini how-to configure and start using XDebug with Aptana Studio 3.3, assuming you have installed xdebug on your system. (In Ubuntu/Linux it's just a sudo apt-get install php5-xdebug).
Configure the debugger
In preferences->Aptana Studio->PHP->PHP Interpreter click on Add..., and specify a name, the php executable(/usr/bin/php in most Linux distributions), the php.ini(/etc/php5/conf.d/20-xdebug.ini on my system), and leave XDebug in the select field of PHP debugger.
Using the debugger
Make a php file and put some code in it:
<?php
$defined_var = 'some value';
echo $defined_var;
echo $undefined_var;
exit();
?>
Save it and press Run->Debug As->PHP Script and you will be prompted to switch Workspace.
Specify a Line Breakpoint by double clicking next to a line number, for example at the line of exit() function.
Press Resume(F8) and you can see that the Debug Current Instruction Pointer moved there.
At the variables tab, you should now see which variables have some value or they are uninitialized. The output can be found at the console tab.
Pressing resume again will terminate the debug.
Of course, this is only the tip of the iceberg regarding debug, but it's a start.
There are many other options to explore and ways to debug your scripts.
I have use Aptana Studio 3.2.2 to develop my Drupal site and use XDebug to debug the project. The Aptana Studio supports xdebug. You need to follow some steps to enable xdebug in Aptana Studio.
Configure xdebug in your php engine properly.
Edit the preference by going Preference -> Aptana Studio -> Editor -> PHP Interpreter.
Add a PHP interpreter and save it.
Now create a new Web Server if no web server is currently working.
Now Apply the changes.
Next, Edit the Debug Configuration using Run -> Debug Configurations -> PHP Web Page.
Add a new web page by selecting a initial script file for the php project.
In the last step, start debugging.
You can find a details step by step procedure in the following link:
http://devcircle.blogspot.com/2013/02/enable-xdebug-in-aptana-studio-3x.html
Hopefully it helps to solve the problem.
For me it worked only after
1. Performing stuffs from here (basically - setting-up the XDebug for remote debugging)
https://jira.appcelerator.org/secure/attachment/26404/ScriptPHPDebugging.pdf
2. installation of "XDebug helper" for chrome, and something similar for FF.
After that I have my remote sessions working just-like-they-did-in-Eclipse.
I want to use Eclipse IDE for PHP. I'm new to Eclipse and also to PHP. I installed Eclipse, PHP and Apache. For Eclipse i installed Zend debugger also. I configured Eclipse and set the paths to PHP exe. But when i try to run small PHP code as a script it shows a error message as bellow.
Error launching 'test'
The session could not be started.
In order to generate debug information, please make sure that the debugger is properly configured as a php.ini directive.
What shall i do for this. Please tell me how to configure Eclipse.
Thanks.
In Debug Configuration -> Installed PHP -> Add (or Edit)
Make sure that the Debugger is set correctly (in my case it should be Xdebug)