The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

How to Enable Profiler for Magento 2 Stores

The launch of Magento 2 has brought a lot of benefits to e-commerce stores. Magento 2 offers a lot of powerful functions as well as integrated intelligent extensions. Creating a faster Magento 2 store is an easy job; however, it is difficult to predict how good an add-on will be as well as to know if it is suitable for a Magento store or not. There are now various tools that help you debug and measure which extensions on your store are taking up too much memory and consuming time. One of the most highly recommended internal debuggers that we would like to mention is Profiler.

In this blog post, we will learn How to Enable Profiler for Magento 2 stores.

Without further ado, let’s get started!

Table of Contents

Benefits of Profiler for Magento 2 stores

Profiler is an internal debugging tool that plays an important role in the development of Magento. It is built in Magento, which helps to identify performance issues on your server. In addition, it also allows you to get a Magento partial load time report. Thanks to this, you can check and see which apps consume your memory and slow down the page load, and improve your online store page speed.

Currently, Magento supports 3 profiler formats: HTML, CSV file, and Firebug. All preset formats are used to analyze performance tasks, show dependency graphs on the Magento page, and reveal unused dependencies to cut down memory and time. You can totally solve all of the above by enabling Profiler in Magento 2.

Let’s jump right into detail!

How to enable Magento 2 Profiler

With previous versions of Magento 2, there are several ways to enable Profiler for eCommerce stores. With the current version, however, there is only one way to allow it. That is to use the .htaccess file. We will explore this step-by-step right now.

Step 1: Add the code in .htaccess file

All you need to do is add the code below in .htaccess file at Magento root directory:

# SetEnv MAGE_PROFILER html

Add the code in .htaccess file
Add the code in .htaccess file

Step 2: Set the value of MAGE_PROFILER

Next, please set the value of MAGE_PROFILER in 3 cases as the following:

  • csv file: You can find the reports in /var/log/profiler.csv
  • html: You can find the results in blocks of HTML code at the end of your store’s homepage
  • firebug: You can find the reports in /var/log/profiler.csv using Firebug output
Set the value of MAGE_PROFILER
Set the value of MAGE_PROFILER

Step 3: Enable Magento 2 Developer mode

To enable Magento 2 Developer Mode, please log in to your SSH, navigate to your store root directory and run the following command:

php bin/magento dev:profiler:enable <type>

Step 4: Refresh the cache

Last but not least, you need to compile as well as refresh the cache to finish.

Check your results

Depending on your configuration, you will see the following output:

  • In HTML Profiler: The Profiler should be placed below the footer of your online storefront. You just need to open the homepage, scroll down and you will see a list of timers_id and execution time of each timer as follows:
ALT_TITLE
CAPTION
  • CSV File: This file is stored in the var/log directory.
ALT_TITLE
CAPTION
  • Dependency graphs: You will see the results of the following page when trying to access your storefront as below:
ALT_TITLE
CAPTION

Common issue after enabling Magento 2 Profiler

A fairly common error is that Magento 2 Profiler is not working.

There will be some cases that HTML Profiler doesn’t work after you have enabled them in Magento. The most likely cause is the HTML code that causes javascript execution error.

Don’t worry since you can completely fix this problem by using other configuration modes like csvfile, etc, or make sure HTML Profiler doesn’t affect anything in the functionality.

Hire Magento Developers

What you need to do is only describing desired features of the Magento website, we will help you to build the store that ticks all the boxes!

Get Started
hire magento developers

Final words

After enabling the Profiler in Magento 2, you can easily detect the applications and software that take up a lot of memory, slow down your website system as well as the hidden reasons behind your poor performance.

We hope this tutorial can help you open up a magical world for your Magento 2 store. As a result, your online store will significantly improve performance and, subsequently increase sales efficiency.

If you find our article missed anything important or need to contribute another documentary, please feel free to leave a comment below.

Thanks a lot for reading!

Image Description
With over a decade of experience crafting innovative tech solutions for ecommerce businesses built on Magento, Jacker is the mastermind behind our secure and well-functioned extensions. With his expertise in building user-friendly interfaces and robust back-end systems, Mageplaza was able to deliver exceptional Magento solutions and services for over 122K+ customers around the world.

Looking for Magento Development Company?

8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.

Get free consultant
development service
x

    Explore Our Products:

    Subscribe

    Stay in the know

    Get special offers on the latest news from Mageplaza.

    Earn $10 in reward now!

    Earn $10 in reward now!

    comment
    iphone
    go up