If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Joomla 2.5.x. How to deal with "Fatal error: Cannot redeclare class Mobile_Detect…"

This tutorial shows how to get rid of the Cannot redeclare class Mobile_Detect error.

1. The following error may appear on itemform page (when you add or edit item):

Fatal error: Cannot redeclare class Mobile_Detect in /templates/theme###/includes/mobile_detect.php

2. In order to get rid of the issue you need to edit templates/theme###/html/com_k2/default/itemform.php file. There you need to replace

require_once ($includesPath);

with

if(!class_exists('Mobile_Detect')){
  require_once ($includesPath);
}

3. Replace original file with modified one.