Viewed   15.7k times

I just installed Xdebug v3.0.0beta1 on my OSX and tried to use it on PhpStorm 2020.1, but I get this :

Xdebug: [Config] The setting 'xdebug.remote_enable' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_enable (See: https://xdebug.org/docs/errors#CFG-C-CHANGED) Xdebug: [Config] The setting 'xdebug.remote_host' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_host (See: https://xdebug.org/docs/errors#CFG-C-CHANGED) Xdebug: [Config] The setting 'xdebug.remote_mode' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_mode (See: https://xdebug.org/docs/errors#CFG-C-CHANGED) Xdebug: [Config] The setting 'xdebug.remote_port' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_port

And the links provided lead to nothing but an image with bugs.

My question is what are the right settings to set and where to actually change them since i have nothing about xdebug in my php.ini file.

 Answers

5

Xdebug 3 will be supported from PhpStorm 2020.3 version only, which is currently in EAP stage (Early Access Program) and will be released in about 1 month time.

For the moment you will have to either stick to Xdebug 2.9 for your 2020.1 IDE version or try latest 2020.3 EAP build: https://www.jetbrains.com/phpstorm/nextversion/

Xdebug 3 is supported in the most recent EAP #6 build: https://blog.jetbrains.com/phpstorm/2020/11/phpstorm-2020-3-eap-6/


As for the Xdebug 3 upgrade in terms of making changes for Xdebug settings (php.ini) -- check this link: https://3.xdebug.org/docs/upgrade_guide

Xdebug 3 related docs are currently hosted on a temporary https://3.xdebug.org/ domain.


You CAN use your 2020.1 PhpStorm with Xdebug 3 if you wish -- just configure Xdebug 3 properly.

It works fine for me with Xdebug 3.0.0beta1, PHP 7.4 x64 on Windows 10 -- see this question: https://.com/a/64820427/783119

Those errors that you see indicate that you still have Xdebug 2 config values in your php.ini.

Friday, November 25, 2022
 
3

I had the exact same error in PhpStorm as the OP.

This answer to a different question solved the problem for me, but I would like to add more detail in my own answer.

The main issue was improperly loaded xdebug. The server mapping issues mentioned in other answers was not an issue for me.

If you load your phpinfo() page and find the xdebug section, and you see this:

XDEBUG NOT LOADED AS ZEND EXTENSION

Then you have to fix that before you try anything else! But sometimes this can take some work to track down, if you have multiple php.ini files.

Also in your phpinfo() page, search for "php.ini", (it should be right near the top) and see your "Configuration File (php.ini) Path", and your "Loaded Configuration File". Those are where your xdebug may be loading.

In my case, I correctly loaded it as a Zend extension in my main configuration file in /usr/local/lib/php.ini, like so:

zend_extension = "/usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"

But in my Loaded Configuration file in /home/someuser/public_html/php.ini, I had it incorrectly loaded like this:

extension=xdebug.so

After fixing that, remote debugging with PhpStorm is working again for me.

As a side note, the first error I saw in PhpStorm was the exact same one the OP mentions, and here is what it looks like:

Cannot accept external Xdebug connection
Cannot evaluate expression 'isset($_SERVER['PHP_IDE_CONFIG'])'

( At first I thought that, because the extension was not loaded properly, PhpStorm was not able to execute PHP code on the server. But now I think PhpStorm only executes php code if you configured an interpreter, which isn't necessary for debugging. For debugging, PhpStorm just needs the xdebug connection and the correct path mappings.)

Later, I found the "Command is not available" error in the xdebug log on my server, which led me to the solution.

Here, by the way, is what I have in my local php.ini for xdebug:

;extension=xdebug.so <- this is the bad line commented!
zend_extension = "/usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"

xdebug.remote_enable=true
xdebug.remote_port="9000"
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/tmp/xdebug-someuser/"
xdebug.profile_enable_trigger=1
xdebug.trace_enable_trigger=1
xdebug.idekey="PHPSTORM"
xdebug.remote_log="var/log/xdebug/xlog"
Sunday, November 20, 2022
 
zeus7
 
4

Be eager in the controller and call .ToList() before disposing in order to schedule the execution of the query immediately before you have left the using block (as after that it is too late, the context is gone):

using (MyEntities db = new MyEntities())
{
    var model = 
        from c in db.Categories
        select new Category 
        { 
            CategoryID = c.CategoryID, 
            Name = c.Name 
        };
    return View(model.ToList()); // <-- .ToList() here
}

Now, while this will solve your particular problem, what developers or dependency injection frameworks usually do is to instantiate the DbContext inside the BeginRequest event, store it inside the HttpContext.Items so that it is available throughout the execution of the entire request and inside the EndRequest method, retrieve it from HttpContext and dispose it.


UPDATE:

Also it is a good practice to use a view model containing only the properties you would like to use in this particular view:

public class CategoryViewModel
{
    public int Id { get; set; }
    public string Name { get; set; }
}

and then inside your action:

public ActionResult Index()
{
    using (MyEntities db = new MyEntities())
    {
        var model = 
            from c in db.Categories
            select new CategoryViewModel
            { 
                Id = c.CategoryID, 
                Name = c.Name 
            };
        return View(model.ToList());
    }
}

and in the view:

@model IEnumerable<MyProject.Models.CategoryViewModel>

@foreach (var category in Model)
{
    <p>
        Id: @category.Id 
        Name: @category.Name
    </p>
}
Sunday, October 30, 2022
 
adentum
 
2

There is a lot of confusion between Scapy and kamene. From https://scapy.net

An independent fork of Scapy was created from v2.2.0 in 2015, aimed at supporting only Python3 (scapy3k). The fork diverged, did not follow evolutions and fixes, and has had its own life without contributions back to Scapy. Unfortunately, it has been packaged as python3-scapy in some distributions, and as scapy-python3 on PyPI leading to confusion amongst users. It should not be the case anymore soon. Scapy supports Python3 in addition to Python2 since 2.4.0. Scapy v2.4.0 should be favored as the official Scapy code base. The fork has been renamed as kamene.

You are using kamene, and old Scapy fork with no support whatsoever.

You probably have installed scapy-python3 on PyPI. Uninstall it and use pip3 install scapy

NOT to use kamene is the best advice I can give you...

Tuesday, November 22, 2022
 
granra
 
1

Xdebug 3 will be fully supported in PhpStorm 2020.3 version only, which is currently in EAP stage (Early Access Program) and will be released in about 1 month time.

It is already supported in the most recent EAP #6 build: check this blog post for more info: https://blog.jetbrains.com/phpstorm/2020/11/phpstorm-2020-3-eap-6/


I have downloaded Xdebug 3.0.0beta1 for my PHP 7.4 on Windows 10, configured it from scratch (using correct Xdebug 3 config values: https://3.xdebug.org/docs/upgrade_guide and https://3.xdebug.org/docs/all_settings) ... and it still works fine in PhpStorm 2020.2.3.

Yes, IDE sends old-style parameters when initiating debugging for a CLI script (like xdebug.remote_{host, port} etc) but the debug still works just fine.

This is my php.ini content for Xdebug 3 settings (as simple as this):

[xdebug]
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9001
xdebug.mode = debug

(I have a bit mores settings, but those are customisation for output file names, log locations, extra stuff for quickly turn on some options in some scenarios/when needed etc -- these are not needed here and it works fine without them)

CLI debug initiated from IDE ("PHP Script" type of configuration):

That's what IDE is executing: E:Projectsphpphp74php.exe -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9001 -dxdebug.remote_host=127.0.0.1 E:Projectsweb_idetesttest.php. As you may see these old style parameters do not affect Xdebug 3 at all.

P.S. If I set xdebug.start_with_request = yes in php.ini then debug will work even for Run (or when executing that PHP script outside of IDE) -- as long as "phone handle" icon is green (IDE listens for incoming debug requests).

Friday, October 7, 2022
 
steveg
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share