Trying to use the Xdebug Profiler to find bottlenecks in my script, I tried to change the [XDEBUG] section in the php.ini file to this:

xdebug.mode=profile
xdebug.output_dir="C:\MyFolder"

Unfortunately when trying to start the website within VS, I get this message:

  • When clicking Continue, the value of xdebug.mode is set back to debug.
  • When clicking Cancel, the application will not be started.

My question

Is there any built-in support for running the Xdebug Profiler in PHP Tools?

If not, any chance to not get the above error message to be at least able to run the profiler and manually inspect the results?

Thanks for reporting the issue!

xdebug.mode=profile

This configuration does not work with debugging (breakpoints wouldn't work), so upon pressing F5 it fails the validation.

Run without Debugging (Ctrl+F5) command should ignore it, but it doesn't either (that's a bug -> fixing it).

About profiler; we are planning to implement Profiler UI, but it's not there yet.

7 months later

UweKeim Hi Uwe!

I have released a pre-release version 1.72.17531 which has an experimental version of the PHP profiler. It allows to:

  • profile tests
  • launch PHP built-in server in profiling mode
  • it collects profiling files and shows the results;

Note: it starts php.exe with the correct directives for xdebug.mode, output_dir, etc. No need to change them in php.ini.

Profiling web requests on built-in web server

open PHP profiler Tool Window

Choose project, check php arguments, and Start

Make some requests on http://localhost:8000 (or the port you specify in Arguments)

Then click "View"

Profiling PHPUnit Test

In Test Explorer, click "Profile" in the context menu:

This is incredibly awesome, will test as soon as possible, thank you very much, Jakub! 🙂

    21 days later

    Just tried it today for the very first time.

    An I honestly have to say that this feature is implemented f-ing incredible awesomely! Clicking the requests and then having the Details in an awesome good looking window right inside VS is so much better than the previous external profiling log file viewers that I know.

    Hope you stay this way and keep improving the profiling experience constantly further in the coming releases (not sure in which direction, probably this is already feature-complete, but one never knows 😀).

      UweKeim Thank you very much for trying it and for the feedback! I'm super happy you like it.

      For the future, I'm thinking about

      • a better way of starting profiling, maybe a quick context menu command ..
      • highlighting "hot-path" in source code
      • displaying function time in code lenses right in the PHP code editor

      For the upcoming release, it's feature-complete, but in the future, we'll keep improving :)

      Write a Reply...