Hi there:

I am using PHP Tools with Visual Studio 2022. Debugging is insanely slow. Takes about 30 seconds for the home page to load, and every page I go to takes that long also. This is a Wordpress site, so it may be related to that.

Any suggestions? Thanks.

kim

Hi Kimberly,

Thank you for the post. It's hard to guess what might be causing the slowness here, this obviously shouldn't happen.

Would you like to have a call and we can take a look together?

Thank you

    a year later

    Hi there
    I am new to the party and experiencing the same issue. Loading a local webpage, with a local database and everything else local takes at least 30 seconds. Are there any news on this?

    My assumption is there is something interrupting the communication of php_remote.exe, PHP.Debugger.Systray.exe, xdebug and visual studio.

    The beginning of my VS output states there is a directory mapping missing, may that be the issue?

    > Starting Debugger Server ...
    > Listening to Xdebug on 0.0.0.0:9003,[::]:9003
    > Debugger Server is running.
    Auto-attach to process '[11584] PHP.Debugger.Systray.exe' on machine 'MyPC' succeeded.
    > Accepting connection from Xdebug.
    > Sending the socket to Visual Studio (port 51802)
    No directory mapping established.

    Later while running the web output, my VS output is full of this:

    > Accepting connection from Xdebug.
    > Sending the socket to Visual Studio (port 51802)
    Auto-attach to process '[9416] php_remote.exe' on machine 'MyPC' succeeded.
    > Accepting connection from Xdebug.
    > Sending the socket to Visual Studio (port 51802)
    The program '[9416] php_remote.exe' has exited with code 4294967295 (0xffffffff).
    Auto-attach to process '[5436] php_remote.exe' on machine 'MyPC' succeeded.
    The program '[5436] php_remote.exe' has exited with code 4294967295 (0xffffffff).
    > Accepting connection from Xdebug.
    > Sending the socket to Visual Studio (port 51802)
    Auto-attach to process '[28244] php_remote.exe' on machine 'MyPC' succeeded.

    My setup:

    • Windows 10 21H2 19044.2728
    • Visual Studio Enterprise 2022 17.5.3
    • PHP Tools for Visual Studio 1.72.17474.2022
    • PHP 7.4 (auto install)
    • Using Built-in Web Server with Runtime PHP 7.4.33 (nts win32 vc15 x64, (auto install))
    • Maria DB 10.3 x64

    Thank you and kind regards, Raphael

    Update:

    • Tried to switch from Built-in Webserver to IIS Express, followed auto installation instructions. Same slow effect, same log output except that the process is attached to php-cgi.exe instead of php_remote.exe.
    • Starting WITHOUT debug from VS is NOT better, still have to wait for ages.
    • Build and start up also took more than 20 seconds, but that is not my main issue:
      Build started...
      1>------ Build started: Project: MyApp, Configuration: Debug Any CPU ------
      ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
      ========== Build started at 10:08 AM and took 23.676 seconds ==========

      Hello Raphael,

      Thank you for your post.

      Could you please check if disabling script debugging has any effect?

      Btw. build on itself should not take 23.6s, it basically doesn't do anything.

      Do you have new project type or the legacy one? (You can take a look at the Solution Explorer, if you see Dependencies, it's a new one, if References it's the old one)

      Thank you

      Dear Miloslav

      Thank you for your quick reaction. I checked Script Debugging, it is Disabled.

      I do have "Dependencies" in Solution Explorer. When I look Dependencies, it contains "Composer". Solution and project have been created approx. one week ago from an existing code base. I used same Visual Studio and same PHP Tools Versions as mentioned in my previous post.

      There is another issue I experience, it doesn't bother me too much, but it might be related. When changing the project properties (for example switching from Built-In Web Server to IIS Express), Visual Studio stops responding for a couple of seconds (I would guess up to 10 seconds).

      Another strange thing is, when starting to debug, I see for a few second no reaction of Visual Studio. It takes a while until it starts "building" and so on.

      Kind regards, Raphael

        MiloslavBeno

        I figured out the reason for the long build and startup time. There are many GBs of images in the solution folder. I excluded them from git, but not from the solution. Now it is excluded from both and the solution is starting fast.

        Anyway, the website stays terribly slow.

        Kind regards, Raphael

        7 days later

        Disable Diagnostic Tools: In some cases, the Diagnostic Tools window can cause slow debugging performance. You can disable it by going to "Tools" > "Options" > "Debugging" > "General" and unchecking "Enable Diagnostic Tools while debugging".

        Disable Just My Code: Just My Code is a debugging feature that hides third-party and framework code, but it can also slow down the debugging process. You can disable it by going to "Tools" > "Options" > "Debugging" > "General" and unchecking "Enable Just My Code".

        Use Release Build Configuration: Debug builds contain additional debugging information that can cause the application to run slower. Try switching to the Release build configuration to see if it improves performance.

        Raphael Thank you! Great, at least one thing is out of the way:)

        About the properties change lag. Did the excluding imgs helped this?

        About the website slowness. I don't think what @Marcusnguyenrichard suggested will work, since non of that currently has an effect on PHP debugger.

        Could you please try to run the site with Ctrl+F5 - without the debugger? Just to check the cause of the slowness is in the debugger or something else.

          Hi @Marcusnguyenrichard and @MiloslavBeno

          Indeed, none of the suggestions by Marcusnguyenrichard helped in any way. Also executing without the debugger did not bring any benefits. I still believe it has something to do with the php.exe repeatedly exiting with code 4294967295 (0xffffffff).

          The lag when changing project properties is still present.

          Kind regards

            Write a Reply...