How to enable profiler in magento2:
As of now from admin section to enable the profiler option is removed from the latest version. To enable the profiler we can add it from index.php or apache/nginx conf file.
Enable Profiler from index.php:
1. Open root>pub>index.php from magento2
2. Add following line from the file $_SERVER[“MAGE_PROFILER”]=”html”;
3. Clear cache you can able to see the profiler.
Enable profiler from apache conf or magento2 .htaccess :
1. We can also set the profile or enable the profiler from the Apache vhost file or .htaccess file.
2. Open .htaccess from following path root\pub\static\.htaccess or root\.htaccess(here i have mentioned .htaccess file, while in development mode)
3. Add following code in top of the .htaccess file, “SetEnv MAGE_PROFILER csvfile”
Enable profiler from nginx conf:
1. Open nginx.conf file
2. Add following line “fastcgi_param MAGE_PROFILER html” from ngnix.conf
Ex:1 from nginx.conf file, enable following line.
fastcgi_param MAGE_PROFILER $MAGE_PROFILER;
Ex: 2 Set profiler format:
server {
listen 80;
listen 443 ssl;
ssl_certificate /etc/ssl/certs/local/local.pem;
ssl_certificate_key /etc/ssl/certs/local/local.key;
server_name test.com;
set $MAGE_MODE developer;
set $MAGE_PROFILER html;
include /test.com/html/www/nginx.conf;
}
/etc/ngnix/conf.d/