title: PHPMyAdmin 500 Internal Server Error in Apache due to PHP Version
body: <p><strong>Version:</strong></p>
  <ul>
  <li>OS <code>lsb_release -a</code> : Ubuntu 18.04.5 LTS</li>
  <li>PHP <code>php -v</code> : 8.0.1</li>
  <li>Apache <code>apache2 -v</code> : 2.4.29 (Ubuntu)</li>
  <li>MySQL <code>mysql --version</code> : mysql  Ver 14.14 Distrib 5.7.32</li>
  </ul>
  <hr />
  <p><strong>Problem:</strong></p>
  <p>I'm trying to install LAMP Stack using following <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-20-04" rel="nofollow noreferrer">article</a>. However, I was getting <code>HTTP 500 Error</code> while accessing <code>phpmyadmin</code> from browser.</p>
  <p>And installed phpmyadmin using below command.</p>
  <ul>
  <li><code>sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl</code></li>
  </ul>
  <hr />
  <p><strong>Tried :</strong></p>
  <p>So, I checked with Error Log <code>tail -f /var/log/apache2/error.log</code> and found that Phpmyadmin was running on depreciated version of PHP.</p>
  <pre><code>[Sat Jan 30 12:56:38.798871 2021] [php:error] [pid 17271] [client 
  103.25.169.179:28514] PHP Fatal error:  Array and string offset access 
  syntax with curly braces is no longer supported in 
  /usr/share/phpmyadmin/libraries/Util.php on line 2087
  
  [Sat Jan 30 12:56:38.798871 2021] [php:error] [pid 17271] [client 103.25.169.179:28514] PHP Fatal error:  Uncaught ValueError: 
  mb_convert_encoding(): Argument #2 ($to_encoding) must be a valid 
  encoding, &quot;&quot; given in /usr/share/php/php-php-
  gettext/gettext.inc:181\nStack trace:\n#0 /usr/share/php/php-php-
  gettext/gettext.inc(181): mb_convert_encoding()\n#1 /usr/share/php/php-
  php-gettext/gettext.inc(278): _encode()\n#2 /usr/share/php/php-php-
  gettext/gettext.inc(285): _gettext()\n#3 
  /usr/share/phpmyadmin/libraries/sanitizing.lib.php(179): __()\n#4 
  /usr/share/phpmyadmin/libraries/Message.php(607): PMA_sanitize()\n#5 
  /usr/share/phpmyadmin/libraries/Message.php(672): 
  PMA\\libraries\\Message::decodeBB()\n#6 
  /usr/share/phpmyadmin/libraries/Error.php(220): PMA\\libraries\\Message-
  &gt;getMessage()\n#7 /usr/share/phpmyadmin/libraries/ErrorHandler.php(193): 
  PMA\\libraries\\Error-&gt;getHash()\n#8 
  /usr/share/phpmyadmin/libraries/ErrorHandler.php(156): 
  PMA\\libraries\\ErrorHandler-&gt;addError()\n#9 [internal function]: 
  PMA\\libraries\\ErrorHandler-&gt;handleError()\n#10 
  /usr/share/phpmyadmin/libraries/session.inc.php(133): ini_set()\n#11 
  /usr/share/phpmyadmin/libraries/common.inc.php(280): require('...')\n#12 
  /usr/share/phpmyadmin/index.php(13): require_once('...')\n#13 {main}\n  
  thrown in /usr/share/php/php-php-gettext/gettext.inc on line 181
  
  </code></pre>
  <ul>
  <li>I'd solved <em>Array and string offset access syntax error</em> by removing <code>{ }</code> with <code>[ ]</code></li>
  <li>Run the following command <code>sudo phpenmod mbstring</code></li>
  </ul>