archonproject/archon

PHP Fatal error upon EAD import attempt

Opened this issue · 1 comments

Hello,

I came across the following error when attempting to upload an EAD file into an Archon test server. When I attempted to upload the file, the admin interface stuck at "Parsing file php..."

Screen Shot 2020-09-14 at 10 15 11 AM

Upon further inspection of the error.log file, I came across the following entry.

PHP Fatal error:  Call to undefined function mb_detect_encoding() in /var/www/archon/htdocs/packages/collections/db/import-ead.inc.php on line 67, referer: http://<ip-address-here>/index.php?p=admin/core/database

I checked the import-ead.inc.php file, and I could in fact find no instance of the mb_detect_encoding function defined elsewhere within the file. I also performed a grep -R for mb_detect_encoding on the /var/www/archon/htdocs directory, and the only line that came back from this search is the previously-mentioned line import-ead.inc.php. The context for this function call is as follows:

foreach ($arrFiles as $Filename => $strXML)
      {
         echo("<br/><br/>\n");

         echo("Parsing file $Filename...<br/>\n");

         $currEncoding = mb_detect_encoding($strXML, 'UTF-8, ISO-8859-1');
         if ($currEncoding != 'UTF-8')
         {
            echo("File encoded in $currEncoding. Converting to UTF-8...<br/>\n");
            $strXML = encoding_convert_encoding($strXML, 'UTF-8', $currEncoding);

Below are my current version details:

Server: Ubuntu 16.04 LTS (minimal image from Canonical on AWS Marketplace)
Apache Version: Apache/2.4.18
MySQL Version: Ver 14.14 Distrib 5.7.31, for Linux (x86_64)
PHP Version: PHP 5.6.40-30

Archon Version: 3.21-rev. 3

Has anyone else experienced this issue and/or produced a local fix for this problem?

The mb_detect_encoding function is part of the PHP mbstring module. It seems like this module may not be enabled on your server instance. Check the "advanced" installation instructions here (https://github.com/archonproject/archon/blob/master/README.advanced.md), and make sure all of the listed packages have been installed. I believe mbstring gets included as a dependency of the various php packages listed.