Enable Xdebug to profile your PHP app on App Service

Since the old blog post for enabling Xdebug we have included Xdebug DLLs at the platform level but this is not enable due to performance impact on your app. Follow the steps below to enable Xdebug on Azure app service Web Apps.

Enable Xdebug

Step 1: Create a new folder in the bin directory called xdebug_profiles. If you don’t have a bin directory under wwwroot , create a bin directory. xdebug_profiles folder to which profiling results will be written.

Step 2: Add a directory ini directory to the d:\home\site directory. Create extensions.ini file d:\home\site\ini folder. Add the following code

[XDebug]
zend_extension=d:\devtools\xdebug\v2.4.0\php_xdebug_2.4.0.dll 
xdebug.profiler_enable=1
xdebug.profiler_output_dir="d:\home\site\bin\xdebug_profiles"

Step 3: Add app setting PHP_INI_SCAN_DIR and set it to value d:\home\site\ini. Save your setting .


Step 4: Browse your web app. Check the folder d:\home\site\bin\xdebug_profiles to view your xdebug profiler results. You can open the files using Wincachegrind.

Disable Xdebug

Update the file d:\home\site\ini\extensions.ini and change the setting xdebug.profiler_enable to 0.

xdebug.profiler_enable= 0

References

Xdebug official website

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s