MIDAS Knowledge Base MIDAS Knowledge Base

How to fix a "Can't locate midascommon.pm in @INC" error

"midascommon.pm" is a dedicated Perl module for MIDAS. It is located on your server at the same location as your MIDAS system is installed.

MIDAS requires this module in order to function correctly. A "Can't locate midascommon.pm in @INC" error - either displayed in your browser, or in your server's error log - indicates that your Perl installation was unable to locate this module. In such instances, this will likely be because your MIDAS install location is not one of the locations on your server where Perl looks for external modules.

If you encounter such an error after installing a self-hosted edition of our MIDAS software on your server, there are a couple of potential causes for this:

  • Perl 5.26 (and some installs of Perl 5.24) and older versions of MIDAS

    If you're running Perl 5.26 (or later) and are installing an older version of MIDAS (v4.19 or earlier), you will likely encounter this "Can't locate midascommon.pm in @INC" issue.

    This is because in versions of Perl 5 prior to 5.26, when executing Perl scripts Perl would search for modules in the current working directory. This behavior was changed in Perl 5.26, in which Perl will no longer attempt to locate modules in the current working directory.

    We are aware that this fundamental change in where Perl looks for modules has also been 'back ported' into some recent Linux versions of Perl 5.24 (notably on Debian systems).

    There are two resolutions for this issue; the first is simply to install the latest version of MIDAS (v4.20 or later, built after 19th December 2018). We've made changes in v4.20 to compensate for this change in Perl, so installing the latest version of MIDAS will avoid this issue.

    Whilst ensuring you're installing the latest version of MIDAS is the simplest and recommended solution, if installing the latest version of MIDAS isn't an option (i.e. if you don't have an active MIDAS subscription), and you run into this issue, then you'll need to "force" Perl to look for modules in the current working directory (i.e. the server location where your MIDAS system is installed).

    There are two possible ways to instruct Perl where to look for modules;

    1. Install (or re-install) MIDAS, but append " -l path/to/your/midas/system" to the "Path To Perl" setting you enter during install.

      For example, if Perl is located on your server at /usr/bin/perl, and you're installing MIDAS to /var/www/html/midas, specify the Path To Perl to be "/usr/bin/perl -l /var/www/html/midas". The "-l" switch instructs Perl at runtime where to look for modules. Alternatively;

    2. Modify the PERL5LIB environmental variable to include the location of your installed MIDAS system.

      For example, on a Linux server, if your MIDAS system is installed under /var/www/html/midas, from the Bash call:

      export PERL5LIB=/var/www/html/midas

      You can add this to the ~/.bashrc to ensure the variable is always set upon server restarts.

      Alternatively, on a Windows server, if your MIDAS system is installed under C:\Apache24\htdocs\midas, from an administrative command prompt (cmd) call:

      set PERL5LIB=C:\Apache24\htdocs\midas

      To ensure that this variable is automatically set upon server reboots, you can also define it an Environment Variable via System Properties → Advanced → Environmental Variables.

  • "mod_perl" running on your server

    Some server installations, such as Apache installed via some versions of XAMPP, have an extension known as "mod_perl" enabled by default.

    "mod_perl" is not required by MIDAS and is known to cause problems, including a "Can't locate midascommon.pm in @INC" error.

    To resolve this issue, please disable the "mod_perl" extension on your server. The following article explains how to disable mod_perl.


You might also be interested in...


MIDAS » KB » Support » Article 00031

← Return to the Knowledge Base