Apache2 Xdebug not stopping in breakpoint in PhpStorm - apache2

I'm using Ubuntu 16.04 and I have my projects on a plain Apache 2 with PHP 7.3. I have installed Xdebug but for some reasons I can't make it stop at the breakpoint.
Am I missing some configs here? I tried calling xdebug_get_code_coverage(); function to check if I do have Xdebug installed and yes the function does exist.
I also have the PhpStorm configs set.
I have these entries on all my php.ini files. apache2, cli and fpm. just to make sure
[Xdebug]
zend_extension=/usr/lib/php/20180731/xdebug.so
xdebug.default_enable=1
xdebug.idekey=PHPSTORM
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_port = 9000
xdebug.remote_connect_back=1
My listener is also turned on and my breakpoints are set:
But when I hit http://localhost/info/test.php?XDEBUG_SESSION_START=1
its not stopping on the breakpoints.

Related

In Xdebug v3 if I change a breakpoint while step debugging I get nginx 502 Bad Gateway

I'm running PHP 7.4 in Docker. I am able to step debug just fine, however, unlike in Xdebug v2 if I add a breakpoint or remove a breakpoint while step debugging I am getting a 502 Bad Gateway message from nginx and the step debugging session just dies.
Am I missing a setting for Xdebug v3 in order to set new breakpoints or remove breakpoints while step debugging without killing the session?
php.ini settings
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.discover_client_host=true
xdebug.max_nesting_level=1500
Environment variable for Xdebug session set in docker:
XDEBUG_SESSION: docker
It's Xdebug issue: https://bugs.xdebug.org/view.php?id=1897 (https://bugs.xdebug.org/view.php?id=1899 is a duplicate of that).
Says fixed for next Xdebug v3.0.1 (you can build from sources if you can and need it now).
UPDATE 2020-12-04: Xdebug 3.0.1 has been released.

Xdebug not working with supervisor as background runner

I currently have an issue that I don't really understand.
Here's the situation:
I'm running PHP7.2 in an Debian based box under Vagrant and Parallels on an Mac.
Config for Xdebug:
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.default_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_host = 192.168.24.1
xdebug.remote_port = 9000
xdebug.idekey=PHPSTORM
xdebug.remote_log="/home/vagrant/base/log/xdebug.log"
Calling the Symfony CLI app works fine.
But as soon as I call it over supervisor Xdebug doesn't respond as it should.
I tried several things but failed.
In PhpStorm I get this message:
Cannot find file '/VMPATH/console' locally.
To fix it, set server name by environment variable PHP_ID_CONFIG and restart debug session
but I can't really find any help in the net on how to fix this issue.
Any help is appreciated!
Try add the line
environment=PHP_IDE_CONFIG="serverName=PHPSTORM"
to your supervisor config block. Example:
[program:my_worker]
directory={{API_PATH}}
command={{API_PATH}}/my_worker.php "verificationWorker.php"
environment=PHP_IDE_CONFIG="serverName=vagrant"
user=www-data
autostart=false
autorestart=true
Detail here
And make sure you execute background script by php with installed xDebug extension.

Setting up phpstorm with xdebug

I have been trying to set up remote (virtual box server) debugging with phpstorm. When I press the debug button phpstorm just waits indefinitely for a connection. I've been looking for a solution for a couple days, and cannot get any varying results.
These are my phpstorm settings:
Host: mywebsite.dev
Port: 9000
Debugger: Xdebug
pathmapping: /public <--> /index.php
These are my xdebug params in php.ini
xdebug.remote_enable=on
xdebug.remote_autostart=off
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=on
xdebug.remote_port=9000
xdebug.default_enable=on
xdebug.remote_mode=req
xdebug.remote_log=/var/log/xdebug/xdebug.log
Please let me know if you need anymore information. Thanks in advance!
This tutorial worked for me in Ubuntu
http://confluence.jetbrains.com/display/PhpStorm/Xdebug+Installation+Guide
I notice your php.ini looks a bit different. Here is mine :
[Xdebug]
zend_extension=<full_path_to_xdebug_extension>
xdebug.remote_enable=1
xdebug.remote_host=<the host where PhpStorm is running (relative to your site!)>
xdebug.remote_port=9000
And that was it.
Answering an old post for the heck of it...
You also need to edit you 20-xdebug.ini file
sudo nano /etc/php5/conf.d/20-xdebug.ini
The line zend_extension=xdebug.so should already be there. Add the following lines :
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.scream=0
xdebug.cli_color=1
xdebug.show_local_vars=1
There might be path mapping issues as well.
If you go in run|web server debug validation … do you get error messages ? If so, that’s a clue to what you still need to solve.
You also have to set the key to your xdebug extension in your browser.

Phpstorm does not see xdebug but it is installed

PhpStorm cannot see xdebug but it is installed. In my browser xdebug works fine. Where is the problem?
The error:
Connection with 'xdebug' was not established. Validate installation.
php.ini
[xdebug]
xdebug.idekey=PHPSTORM
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.default_enable=1
xdebug.coverage_enable=1
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "/tmp"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_autostart=1
phpinfo in phpstorm:
PHP version: 5.4.10
Loaded extensions: bcmath, bz2, calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imap, json, ldap, libxml, mbstring, mcrypt, mysql, mysqli, openssl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, Reflection, session, SimpleXML, soap, sockets, SPL, sqlite3, standard, tokenizer, XCache, xml, xmlreader, xmlwriter, xsl, yaz, zip, zlib
First, are you using MAMP (free) or MAMP Pro?
Turns out there is a difference between the php.ini file you edit from MAMP and the php.ini file that PhpStorm uses in the interpreter.
The MAMP Pro php.ini file resides in /Library/Application Support/appsolute/MAMP PRO/conf/php.ini and doesn't have a PHP installation (which PhpStorm needs when setting the interpreter). If you run phpinfo(); this is the file you will see data from.
When you set PhpStorm to the necessary location here /Applications/MAMP/bin/php/php5.4.x/bin it looks at the php.ini file there, not the one that MAMP Pro uses (above). So if you want PhpStorm to see the debugger, you need to add the code to that php.ini file.
For help setting up the interpreter for MAMP and PhpStorm refer to the documentation here
HELPFUL HINT: When checking to see if xdebug is installed make sure to run the --version command in terminal from the MAMP php location. Otherwise you'll end up seeing the default OSX PHP info which wouldn't have xdebug installed by default.
Example: run this in the PhpStorm terminal to see if it works /Applications/Mamp/bin/php/php5.4.4/bin/php --version
MAMP using different php.ini if you run it from terminal, try this code to find the php.ini
php -i | grep php.ini
After that add the code for activate the xDebug
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.remote_host=localhost
xdebug.profiler_output_dir="/Applications/MAMP/tmp/xdebug"
xdebug.max_nesting_level=1000
If this work, please consider accept the answer for the benefit the others.
This is because Mac OS X has php installed by default. There are two ini files for MAMP PRO.
PhpStorm will run the default php which you do not add the xdebug function to it.
Read this post for the solution
http://devnet.jetbrains.com/message/5466653
Pay attention to the STEP 5
===================================
okay, if it do not work, I thought u may not pay enough attention to the article, It do helpful and explain the reason, read i again ?
I had similar problem.
I did:
Installed xdebug by following the steps here.
Found out which version of PHP does my PHPStorm use.
Created a new entry in the corresponding php.ini file of the /path/to/xdebug/modules/xdebug.so.
and I was able to solve my problem. xdebug is working now.
I had a similar issue in that it worked then it did not.
In my case, the cause turned out to be an miss placed .htaccess file in the root of the project.
The .htaccess file (repeated below) was there from a previous set of testing and was intended to stop XDebug from working. It sure did.
php_value xdebug.remote_autostart 0
php_value xdebug.remote_enable 0
php_value xdebug.profiler_enable 0
I just renamed the file and like magic, all was good.

Waiting for the XDebug Session 57% in Eclipse PDT

Browsing the hints when I write this message it seems this is a tough question with all kind of patches, but no clear answer ... Anyway, I try my chance, here it is.
I'm using Eclipse Helios PDT on Ubuntu 10.04, with XDebug and the corresponding section in php.ini as following:
xdebug support enabled
Version 2.0.5
Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.125.2.6 $
GDB - GNU Debugger protocol $Revision: 1.87 $
PHP3 - PHP 3 Debugger protocol $Revision: 1.22 $
Directive Local Value Master Value
xdebug.auto_trace Off Off
xdebug.collect_includes On On
xdebug.collect_params 0 0
xdebug.collect_return Off Off
xdebug.collect_vars Off Off
xdebug.default_enable On On
xdebug.dump.COOKIE no value no value
xdebug.dump.ENV no value no value
xdebug.dump.FILES no value no value
xdebug.dump.GET no value no value
xdebug.dump.POST no value no value
xdebug.dump.REQUEST no value no value
xdebug.dump.SERVER no value no value
xdebug.dump.SESSION no value no value
xdebug.dump_globals On On
xdebug.dump_once On On
xdebug.dump_undefined Off Off
xdebug.extended_info On On
xdebug.idekey no value no value
xdebug.manual_url http://www.php.net http://www.php.net
xdebug.max_nesting_level 100 100
xdebug.profiler_aggregate Off Off
xdebug.profiler_append Off Off
xdebug.profiler_enable Off Off
xdebug.profiler_enable_trigger Off Off
xdebug.profiler_output_dir /tmp /tmp
xdebug.profiler_output_name cachegrind.out.%p cachegrind.out.%p
xdebug.remote_autostart Off Off
xdebug.remote_enable Off Off
xdebug.remote_handler dbgp dbgp
xdebug.remote_host localhost localhost
xdebug.remote_log no value no value
xdebug.remote_mode req req
xdebug.remote_port 9000 9000
xdebug.show_exception_trace Off Off
xdebug.show_local_vars Off Off
xdebug.show_mem_delta Off Off
xdebug.trace_format 0 0
xdebug.trace_options 0 0
xdebug.trace_output_dir /tmp /tmp
xdebug.trace_output_name trace.%c trace.%c
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth 3 3
I've been using Eclipse for PHP development without any problem so far, but never used debugging. When I launch the project in debugging mode I get the application correctly launched in the browser in the background, my by Debug/PHPDebug perspective is empty, while in the Eclipse console I have the message in the Title of this posting.
Thanks for any help
If Eclipse is stopping at 57%, then the remote debugging process couldn't be started. This might the case, when...
You didn't enable remote debugging in the file /PHP/php.ini:
xdebug.remote_enable=on
the remote host ip address (client which starts debug session (your IDE)) isn't correct:
xdebug.remote_host=IP_ADDRESS
Instead of defining the remote hosts ip address you can enable "multihost" remote debugging using:
xdebug.remote_connect_back=1
Also checkout the xdebug documentation for all settings: http://xdebug.org/docs/all_settings
I was struggling to setup xdebug and eclipse for an age.
I use ubuntu 12.04 on a 32bit system.
To setup the latest version of eclipse (juno) and the lamp tech stack i can strongly recommend this tutorial. There's a very good guide for setting up virtual hosts, too - script included.
Instead of following their section on installing xdebug, rather use xdebug's custom installation instructions referred to by #hakre in a related post.
Once xdebug shows up in the phpinfo output, you can continue by setting up eclipse for xdebug as described in the tutorial mentioned before.
If it still doesn't work make sure you
have read the answer above
xdebug's port is free and matches eclipse's debug configuration -> server tab -> server section -> configure button (9030 by default!)
and try
cutting the quotes from the zend_extension property within your php.ini file
putting all your xdebug-settings in your php.ini file - i dont have a xdebug.ini file in use.
repeating the filename within eclipse debug-configuration -> server tab -> url section -> last input field as shown below.
I found the problem for me was related to a specific browser, Firefox, and possibly due to an update of java to 7_21.
See my solution here
Eclipse, XAMPP, xDebug - waiting for XDebug session - stays in 57%
I had the same issue and searched for ages trying to fix it! I verified everything with my remote host, my port listening, and my Eclipse settings. I finally found the problem was that I needed to specify the IDE for XDebug in my php.ini, like:
xdebug.idekey=ECLIPSE_DBGP
Try edit the php.ini at: wamp\bin\apache\Apache2.4.4\bin
xdebug.remote_enable = on
xdebug.remote_host="localhost"
xdebug.remote_connect_back=1
I had the ame issue - editing the php folder php.ini when using WAMP seems to be not enough.
I had the exact same problem after I made a custom php build which accidentally replaced the original apache php module:
/usr/lib64/httpd/modules/libphp5.so
/usr/lib64/httpd/modules/libphp5-zts.so
To me, the fix is:
sudo rpm -e --nodeps php
sudo dnf install php
sudo service httpd restart
I found that for me it was the missing xdebug.idekey=ECLIPSE_DBGP in c:>\php\php.ini
Anyway this is my current php.ini configuration for xdebug, note I've not set the remote address:
[xdebug]
zend_extension=C:\php\ext\php_xdebug-2.9.6-7.3-vc15-nts-x86_64.dll
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_handler=dbgp
;xdebug.remote_host=127.0.0.10
xdebug.remote_autostart=1
xdebug.remote_port=9000
xdebug.show_local_vars=1
xdebug.expose_remotely=always
xdebug.default_enable=1
xdebug.idekey=ECLIPSE_DBGP
My environment:
W10 x64, php7.3.18 non-threadsafe, IIS as webserver

Resources