{"id":59408,"date":"2016-01-29T05:34:31","date_gmt":"2016-01-29T10:34:31","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=59408"},"modified":"2017-08-16T10:00:48","modified_gmt":"2017-08-16T14:00:48","slug":"joomla-3-x-how-to-deal-with-fatal-error-cannot-redeclare-class-mobile_detect","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/joomla-3-x-how-to-deal-with-fatal-error-cannot-redeclare-class-mobile_detect.html","title":{"rendered":"Joomla 3.x. How to deal with &#8220;Fatal error: Cannot redeclare class Mobile_Detect&#8221;"},"content":{"rendered":"<p>\r\n<p>This tutorial will show you how to handle the <strong>Fatal error: Cannot redeclare class Mobile_Detect in Mobile_Detect.php ()<\/strong>, which can show up on your website right after the installation or in your Joomla administration panel.<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=4zHV6Sr9kZY?width=1280&amp;height=720\" rel=\"prettyPhoto\">Joomla 3.x. How to deal with &#8220;Fatal error: Cannot redeclare class Mobile_Detect&#8221;<\/a><\/p>\r\n<ol>\r\n<li>\r\n<p>One of the following errors may appear on the item page or right after the installation:<\/p>\r\n<pre>Fatal error: Cannot redeclare class Mobile_Detect in \/templates\/theme###\/includes\/mobile_detect.php<\/pre>\r\n<pre>Warning: require_once(\\templates\\theme####\\includes\\Mobile_Detect.php): failed to open stream: No such file or directory in \/templates\/theme####\/html\/modules.php on line 5<\/pre>\r\n<pre>Fatal error: require_once(): Failed opening required '\\templates\\theme####\\includes\\Mobile_Detect.php' (include_path='.:\/opt\/php54\/lib\/php') in \/templates\/theme####\/html\/modules.php on line 5<\/pre>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.1.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.1-300x64.jpg\" alt=\"how to deal with Fatal error.1\" width=\"300\" height=\"64\" class=\"aligncenter size-medium wp-image-59409\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.1-300x64.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.1-150x32.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.1-1024x219.jpg 1024w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.1.jpg 1302w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>In order to get rid of the issue, you need to locate <strong>modules.php<\/strong> file of your theme in <strong>\\templates\\theme####\\html<\/strong> directory via FTP or File manager and replace the code on line 5:<\/p>\r\n<pre class=\"brush:php\">require_once JPATH_SITE . '\\templates\\\\'.$template.'\\includes\\Mobile_Detect.php';<\/pre>\r\n<p>with:<\/p>\r\n<pre class=\"brush:php\">require_once JPATH_SITE . '\/templates\/'.$template.'\/includes\/Mobile_Detect.php';<\/pre>\r\n<p>\t\t<a href=\"\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.2.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.2-300x95.jpg\" alt=\"how to deal with Fatal error.2\" width=\"300\" height=\"95\" class=\"aligncenter size-medium wp-image-59410\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.2-300x95.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.2-150x48.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.2.jpg 865w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.3.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.3-300x53.jpg\" alt=\"how to deal with Fatal error.3\" width=\"300\" height=\"53\" class=\"aligncenter size-medium wp-image-59411\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.3-300x53.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.3-150x27.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.3-1024x183.jpg 1024w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/12\/how-to-deal-with-Fatal-error.3.jpg 1307w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>Save the changes. There shouldn&#8217;t be any issue now.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<p>NOTE: the code may be different in your file, but its correct structure is as listed above.<\/p>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=4zHV6Sr9kZY?width=1280&amp;height=720\" rel=\"prettyPhoto\">Joomla 3.x. How to deal with &#8220;Fatal error: Cannot redeclare class Mobile_Detect&#8221;<\/a><\/p>\r\n<p><\/p>\r\n<div class=\"inline-banner\">\r\n<a href=\"https:\/\/www.templatemonster.com\/cart.php?addOffer=587\">\r\n<img src=\"\/help\/files\/banners\/inline\/Banner-1-(500-x100).jpg\" \/>\r\n<\/a>\r\n<\/div>","protected":false},"excerpt":{"rendered":"<p>This tutorial is going to show you how to handle the <strong>Fatal error: Cannot redeclare class Mobile_Detect in Mobile_Detect.php ()<\/strong>, which can show up on your website right after the installation or in your Joomla administration panel.<\/p>\n","protected":false},"author":67,"featured_media":59412,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[724],"tags":[691,1393,483,1547,1546,785],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/59408"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=59408"}],"version-history":[{"count":1,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/59408\/revisions"}],"predecessor-version":[{"id":82759,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/59408\/revisions\/82759"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/59412"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=59408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=59408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=59408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}