Categories

Featured templates

Joomla 3.x. How to deal with “Fatal error: Cannot redeclare class Mobile_Detect”

Rating: 5.0/5. From 2 votes.
Please wait...

This tutorial will show you how to handle the Fatal error: Cannot redeclare class Mobile_Detect in Mobile_Detect.php (), which can show up on your website right after the installation or in your Joomla administration panel.

Joomla 3.x. How to deal with “Fatal error: Cannot redeclare class Mobile_Detect”

  1. One of the following errors may appear on the item page or right after the installation:

    Fatal error: Cannot redeclare class Mobile_Detect in /templates/theme###/includes/mobile_detect.php
    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
    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

    how to deal with Fatal error.1

  2. In order to get rid of the issue, you need to locate modules.php file of your theme in \templates\theme####\html directory via FTP or File manager and replace the code on line 5:

    require_once JPATH_SITE . '\templates\\'.$template.'\includes\Mobile_Detect.php';

    with:

    require_once JPATH_SITE . '/templates/'.$template.'/includes/Mobile_Detect.php';

    how to deal with Fatal error.2

    how to deal with Fatal error.3

  3. Save the changes. There shouldn’t be any issue now.

NOTE: the code may be different in your file, but its correct structure is as listed above.

Feel free to check the detailed video tutorial below:

Joomla 3.x. How to deal with “Fatal error: Cannot redeclare class Mobile_Detect”

Professional Joomla Templates
This entry was posted in Joomla! Tutorials and tagged error, fatal, joomla, Mobile_Detect, redeclare, troubleshooter. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket