The debugger is not attached - Xdebug - Atom (php) - php

I'm attempting to install xdebug on to my atom in order to debug my magento 2 code on a wamp server. I think i have installed xdebug successfully according to my phpinfo() file however when I come to attach a debugger in atom, xdebug doesn't appear.
My php.ini settings are:
; XDEBUG Extension
[xdebug]
zend_extension ="c:/wamp64/bin/php/php7.1.16/zend_ext/php_xdebug-2.6.0-7.1-
vc14-x86_64.dll"
xdebug.remote_host=127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_connect_back=1
xdebug.remote_port = 9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true
;xdebug.profiler_enable = off
;xdebug.profiler_enable_trigger = Off
;xdebug.profiler_output_name = cachegrind.out.%t.%p
;xdebug.profiler_output_dir ="c:/wamp64/tmp"
;xdebug.show_local_vars=0
I haven't managed to find a complete tutorial online that works. I was following the Atom Tutorial, however I could not get it to work. I think the error may be with the IDE key as i'm not sure what to do with it. I've followed almost every youtube video but it still seems i'm doing something wrong.
If someone could post a working tutorial I would very much appreciate it. Thanks in advance :)
Screenshot of the problem
PHP Version 7.1.16
Xdebug Version 2.6.1

I've seen in the comment section of the question, that you have moved to Visual Studio Code, But I'll write down this answer anyway as someone else may find it helpful.
I've also came across this issue: "Debugger not attached".
When you install php-debug it require one more package: atom-debug-ui - which is not the issue.
Once php-debug is installed it also recommends to install couple more packages: ide-php and atom-ide-ui. The latter package can be problematic as it also contains it's own debugger UI.
Therefore when you install all four packages, there are two set of debugger UIs running on your Atom IDE.
To overcome this, what you should do is disabling atom-ide-ui's debugger. You can also go ahead and uninstall atom-ide-ui as it's not required for php-debug to run. If ide-php package depends on atom-ide-ui, you can uninstall ide-php as well.
I understand the question is about a setup which runs on WAMP. I've written this article on how to set it up on Ubuntu based Linux. In that article I've provided all the details you want. I don't think it would be too hard to translate the information to Windows based setup.

Related

Using xdebug with PhpStorm

I can't get my PhpStorm IDE to work with xdebug.
My current setup is the following:
PhpStorm 2017.1.4
MacOS Sierra 10.12.5
Here are the steps that I followed.
I have installed php with the following command. I have added the postgres parameter because I need it later to connect to a PostgreSQL database.
brew install php71 --with-postgresql
The next step is to install XDebug with the following command
brew install php71-xdebug
So the next step that I got from the documentation (https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html) is to edit the php.ini file with the following content:
[Xdebug]
zend_extension="<path to php_xdebug.dll>"
xdebug.remote_enable=1
xdebug.remote_port="<the port for Xdebug to listen to>" (the default port is 9000)
xdebug.profiler_enable=1
xdebug.profiler_output_dir="<AMP home\tmp>"
Just some questions about those fields and XDebug.
So I guess XDebug is some kind of service that runs on the remote_port and that PhpStorm is using to write data to? Or do you have to specify the port where the application you want to test is running?
What exactly is the profiler thing? And can the output dir be anything I can choose?
So this is my php.ini file that I think it should be:
[xdebug]
zend_extension="/usr/local/Cellar/php71-xdebug/2.5.4/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/usr/tmp"
That's it for the php.ini. So I have to check the settings in my PhpStorm IDE. And those are the following:
So that is my setup. In my project I just have one index.php with <?php echo phpinfo(); ?> I just click the Chrome icon so it opens directly in the browser to check if XDebug is there. I see the following result.
So I thought to myself ok let's try some debugging. So I changed my index.php file to the following
$i = 2;
$j = $i + 2;
echo $j
I've put a breakpoint on the 2nd line. And when I run it, it never stops at the breakpoint. What is needed to do that or am I wrong in my configuration somewhere?
To make Xdebug remote debugging working on your page, you need to set a cookie in your browser, telling the server you want to debug the page, there are many extensions for that, the most known is Xdebug helper in Chrome.
I also suggest you to follow this tutorial Zero-configuration debugging, it is very detailed and clear IMO.
If you still have problems i'll try to help you with pleasure :)

php zend framework 1 netbeans xdebug

I work in a Mac (OSX 10.10.3 Yosemite), with Bitnami XAMPP 5.6.3, Netbeans 7.3.1, and the xdebug configuration showed down. With my "normal" PHP projects everything works fine, but now I am trying to learn Zend Framework, and I have installed ZendFramework-1.12.17, for which I reached to obtain a "Hello world" in a PHP 5.3 project, but when I try to debug the same project, the status bar of the debbuger remains "Waiting for connection netbeans-xdebug" forever.
I searched the web, but I think that this is so specific case that I could only find an answer on this forum recomending to install XAMPP 1.7.0 :( very old version) that has Zend Extension Manager, something that 1) doubt it can work with my configuration and 2) can affect my other projects.
Can someone help me please? Thank you and best regards.
In php.ini:
zend_extension = /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

Debug php Eclipse

I'm having a very hard time getting a breakpoint to hit in some php code. I don't do much php so might be newbie error.
I've read though the other questions, PDT Install Instructions, and XDebug Install Instructions
For both debuggers, the instructions expect a config section to show up in the phpinfo() and it doesn't for me.
Some info about my current setup
Windows
AMPPS
PHP 5.2.17
Website runs fine
I need some help with things to check or ideas what I might need to do differently.
I'm stuck pretty much for now.
You can follow this post to install Xdebug for PHP in AMPPS.
Two main things that fixed my issues.
Turned off Iron PHP Loader
copied the non-ts XDebug .dll, even though the php config shows thread safe = enabled. This dll seems to work
The config settings are below for reference:
;Stuff to allow debugging in eclipse
zend_extension="C:\Program Files (x86)\Ampps\php\ext\php_xdebug-2.2.3-5.3-vc9.dll"
xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_mode=req
You do have to make sure and add the extra xdebug configurations or eclipse won't cooperate.

XDebug / Apache / PHP / Eclipse skips breakpoints

I'm having problems with XDebug.
Configuration as follows:
Windows 7 64bit
PHP 5.4.6 Thread Safe 32 bit
Apache 2.4 Thread Safe
Eclipse PDT 3.0.2
The problem is that xdebug_break() calls are not working, and breakpoints entered through Eclipse also don't function. I can see that the extension is working, as it appears as a module in phpinfo(). When I call an uncallable method, XDebug outputs the relevant error messages.
I've modified Eclipse's web server path mapping, to no avail.
Here is my php.ini config:
zend_extension = c:/php/php_xdebug-2.2.1-5.4-vc9.dll
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 8080
xdebug.remote_mode = req
Any help would be kindly appreciated...
First check that what version you are using of PHP in eclipse....
Check it through:
Window->preference->PHP->PHP Interpreter....
Version there should match with the PHP version.....
Reply if problem is not solved....
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).

Xdebug PHPStorm IDE ubuntu

I am trying to configure xDebug with phpstorm 2.1 on ubuntu 11.04
In phpstorm I clicked "Start Listen PHP DEBUG CONNECTIONS" and "xdebug Start session" firefox bookmarklet from here http://www.jetbrains.com/phpstorm/marklets/.
But nothing doesn't happen.
PHP 5.3:
extension="xdebug.so" (not zend)
[xdebug]
xdebug.idekey = "PHPSTORM"
xdebug.remote_enable = 1
xbebug.remote_connect_back=1
xdebug.remote_port=9000
I broke my brains why it doesn't work. Need advices. Very thanks
UPD SOLVED: XDEBUG should be installed as zend extension!
Please check you phpinfo() output - it should contain 'Xdebug' section. See Xdebug installation guide
Does Xdebug installed correctly?
Take a look at the tutorial here: http://blogs.jetbrains.com/webide/2011/02/zero-configuration-debugging-with-xdebug-and-phpstorm-2-0/.
You could also take a look at the KomodoIDE remote debugging instructions and see if they help you out: http://docs.activestate.com/komodo/6.1/debugphp.html#debugphp_top.

Categories