Today, we’re going to talk about Magento 2 profiler, what’s its role, and how to enable it.
As you might already know, Magento 2 has been continuously adding many powerful features since it was first launched in November 2015. And there are even more third-party extensions & add-ons being launched in the Magento Marketplace every day to help store owners further enhance the in-built features.
But, before adding any third-party extensions or add-ons, it’s recommended to identify if it is suitable for your Magento 2 store or not. More importantly, you need to debug and measure the third-party extension you’re planning to integrate & find out if it will take too much memory and consume an unnecessary amount of time.
Fortunately, Magento 2 comes with an in-built debugger tool called Profiler to check if a third-party extension or add-on will be a good fit for your store or not.
And in this article, we will show you exactly how to enable Magento 2 profiler.
Step-By-Step Process to Enable Magento 2 Profiler
Please follow the below steps to learn how to enable the profiler in Magento 2.
Step - 1
First of all, log in to FTP/SSH and navigate to the root folder of your Magento 2 store.
Step - 2
After that, open the .htaccess file from the root folder and add the following line at the beginning.
SetEnv MAGE_PROFILER "html"
If you want to direct the profiling information into a CSV file instead of HTML, replace “html” with “csvfile” in the above line, and it will save all output in the var/log/profiler.csv file.
Step - 3
Next, log in to your SSH/CLI shell, navigate to the root folder in your Magento 2 store, and switch it to developer mode by executing the following command:
bin/magento deploy:mode:set developer
And that’s about it! This is the quickest & the most straightforward way to enable Magento 2 profiler.
Conclusion
After enabling the profiler in your Magento 2 store, you should be able to detect any third-party extensions, plugins, add-ons, modules, etc. taking up too much memory or causing poor performance along with their reasons.
With that being said, we hope you found this tutorial helpful. If you need our professional assistance with Magento development company, feel free to reach out to us at any time.