{"id":105057,"date":"2017-12-16T16:20:57","date_gmt":"2017-12-16T16:20:57","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=105057"},"modified":"2023-01-05T14:08:08","modified_gmt":"2023-01-05T14:08:08","slug":"common-error-in-production-mode-when-html-is-minified","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/","title":{"rendered":"Common Error in Production Mode When html is Minified"},"content":{"rendered":"<p>Hello everyone, when you set production mode in your Magento 2 and minify the HTML files to speed your website, you often see an error like <strong>&#8220;<\/strong><b>Parse error<\/b>:\u00a0<strong>syntax error, unexpected &#8216;&lt;&#8216;, expecting end of file&#8221;<\/strong><\/p>\n<p>or some Fatal error as in the below image &#8211;<img decoding=\"async\" class=\"alignnone size-full wp-image-105063\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png\" alt=\"\" width=\"1144\" height=\"98\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png 1144w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error-250x21.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error-300x26.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error-768x66.png 768w\" sizes=\"(max-width: 1144px) 100vw, 1144px\" loading=\"lazy\" \/><\/p>\n<p><strong>Or simply a blank screen.<\/strong><\/p>\n<p>The cause of such errors is hidden in the template files. In the following commented code-<\/p>\n<pre class=\"brush:php\">&lt;?php \/\/echo \"this is an unwanted php code\";?&gt;<\/pre>\n<p>there is no space between the semicolon &#8220;;&#8221; and the closing tag of php\u00a0i.e. &#8220;?&gt;&#8221; which causes the error.<\/p>\n<p>For the above code, when the HTML\u00a0file is minified, the closing tag of php is considered as a part of the commented code which is not included in the minified file and throws the error.<\/p>\n<p>So, while commenting a php code in a phtml file, make sure that there is a space before the closing tag of php as done in the code below-<\/p>\n<pre class=\"brush:php\">&lt;?php \/\/echo \"this is an unwanted php code\";  ?&gt;<\/pre>\n<p>Doing this will avoid the error due to minification of the HTML file.<\/p>\n<p>Hope this will help you.<\/p>\n<p>For any queries, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello everyone, when you set production mode in your Magento 2 and minify the HTML files to speed your website, you often see an error like &#8220;Parse error:\u00a0syntax error, unexpected &#8216;&lt;&#8216;, expecting end of file&#8221; or some Fatal error as in the below image &#8211; Or simply a blank screen. The cause of such errors <a href=\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":167,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302],"tags":[5906,2460,5907],"class_list":["post-105057","post","type-post","status-publish","format-standard","hentry","category-magento2","tag-html-minified","tag-magento-2","tag-production-mode"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Common Error in Production Mode When html is Minified - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Common Error in Production Mode When html is Minified - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Hello everyone, when you set production mode in your Magento 2 and minify the HTML files to speed your website, you often see an error like &#8220;Parse error:\u00a0syntax error, unexpected &#8216;&lt;&#8216;, expecting end of file&#8221; or some Fatal error as in the below image &#8211; Or simply a blank screen. The cause of such errors [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-16T16:20:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-05T14:08:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png\" \/>\n<meta name=\"author\" content=\"Hemant Jain\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hemant Jain\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/\"},\"author\":{\"name\":\"Hemant Jain\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/a824ac6c5c14d32569263100b85f47c6\"},\"headline\":\"Common Error in Production Mode When html is Minified\",\"datePublished\":\"2017-12-16T16:20:57+00:00\",\"dateModified\":\"2023-01-05T14:08:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/\"},\"wordCount\":188,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png\",\"keywords\":[\"HTML minified\",\"Magento 2\",\"Production mode\"],\"articleSection\":[\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/\",\"url\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/\",\"name\":\"Common Error in Production Mode When html is Minified - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png\",\"datePublished\":\"2017-12-16T16:20:57+00:00\",\"dateModified\":\"2023-01-05T14:08:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png\",\"width\":1144,\"height\":98},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Common Error in Production Mode When html is Minified\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/a824ac6c5c14d32569263100b85f47c6\",\"name\":\"Hemant Jain\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/184358b1c25c580a3e32952605156294dedfff2b8b75bdb2a719c8e6a5d318b6?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/184358b1c25c580a3e32952605156294dedfff2b8b75bdb2a719c8e6a5d318b6?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Hemant Jain\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/hemant-jain591\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Common Error in Production Mode When html is Minified - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/","og_locale":"en_US","og_type":"article","og_title":"Common Error in Production Mode When html is Minified - Webkul Blog","og_description":"Hello everyone, when you set production mode in your Magento 2 and minify the HTML files to speed your website, you often see an error like &#8220;Parse error:\u00a0syntax error, unexpected &#8216;&lt;&#8216;, expecting end of file&#8221; or some Fatal error as in the below image &#8211; Or simply a blank screen. The cause of such errors [...]","og_url":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2017-12-16T16:20:57+00:00","article_modified_time":"2023-01-05T14:08:08+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png","type":"","width":"","height":""}],"author":"Hemant Jain","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Hemant Jain","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/"},"author":{"name":"Hemant Jain","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/a824ac6c5c14d32569263100b85f47c6"},"headline":"Common Error in Production Mode When html is Minified","datePublished":"2017-12-16T16:20:57+00:00","dateModified":"2023-01-05T14:08:08+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/"},"wordCount":188,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png","keywords":["HTML minified","Magento 2","Production mode"],"articleSection":["Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/","url":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/","name":"Common Error in Production Mode When html is Minified - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png","datePublished":"2017-12-16T16:20:57+00:00","dateModified":"2023-01-05T14:08:08+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Fatal-error.png","width":1144,"height":98},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/common-error-in-production-mode-when-html-is-minified\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Common Error in Production Mode When html is Minified"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/a824ac6c5c14d32569263100b85f47c6","name":"Hemant Jain","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/184358b1c25c580a3e32952605156294dedfff2b8b75bdb2a719c8e6a5d318b6?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/184358b1c25c580a3e32952605156294dedfff2b8b75bdb2a719c8e6a5d318b6?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Hemant Jain"},"url":"https:\/\/webkul.com\/blog\/author\/hemant-jain591\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/105057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/167"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=105057"}],"version-history":[{"count":11,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/105057\/revisions"}],"predecessor-version":[{"id":363318,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/105057\/revisions\/363318"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=105057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=105057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=105057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}