title: The error "Unable to load dynamic library 'mcrypt'" when executing "php artisan key:generate"
body: <p>My environment:</p>
  <ol>
  <li>XAMPP Version 7.2.8</li>
  <li>PHP 7.2.8 (this was installed together when the XAMPP was installed.)</li>
  <li>Apache 2.4.34 (this was installed together when the XAMPP was installed.)</li>
  </ol>
  <p>I am new to Laravel. I made Laravel project folder and executed the command <code>php artisan key:generate</code> to generate app_key.</p>
  <p>but I got the error below:</p>
  <pre><code>PHP Warning:  PHP Startup: Unable to load dynamic library 'mcrypt' (tried: C:\xampp\php\ext\mcrypt, C:\xampp\php\ext\php_mcrypt.dll) in Unknown on line 0
  </code></pre>
  <p>I checked <code>mcrypt</code> is loaded by following code.</p>
  <pre><code>&lt;?php
  if(function_exists('mcrypt_encrypt')) {
      echo &quot;mcrypt is loaded!&quot;;
  } else {
      echo &quot;mcrypt isn't loaded!&quot;;
  }
  ?&gt;
  </code></pre>
  <p>and it answered <code>&quot;mcrypt isn't loaded!&quot;</code>.</p>
  <p>So, I did as below following <a href="http://www.myoddweb.com/2010/11/18/install-mcrypt-for-php-on-windows/" rel="nofollow noreferrer">this instruction</a> to add <code>mcrypt</code>.</p>
  <p>I downloaded <code>php-5.2.1-Win32</code> from <a href="https://www.php.net/releases/" rel="nofollow noreferrer">this webpage</a>. and copied
  <code>libmcrypt.dll</code> and <code>php_mcrypt.dll</code> in that php version to the ext folder in mine.</p>
  <p><a href="https://i.stack.imgur.com/X2Lkp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X2Lkp.png" alt="enter image description here" /></a></p>
  <p>and I edited php.ini file as below.</p>
  <p><a href="https://i.stack.imgur.com/9xSZv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9xSZv.png" alt="enter image description here" /></a></p>
  <p>for checking the location of php.ini, I use <code>phpinfo()</code>.</p>
  <p><a href="https://i.stack.imgur.com/lJsrY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lJsrY.png" alt="enter image description here" /></a></p>
  <p>and restarted Apache and tried to check if mcrypt is loaded by the program above. But the result was &quot;mcrypt isn't loaded!&quot;.</p>
  <p>I also tried to change the way to write in php.ini file as below:</p>
  <p><a href="https://i.stack.imgur.com/sB2Sd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sB2Sd.png" alt="enter image description here" /></a></p>
  <p>but the result was the same: &quot;mcrypt isn't loaded!&quot;.</p>
  <p>I also tried to check if <code>openssl</code> is enabled by <code>php -r &quot;echo OPENSSL_VERSION_TEXT;&quot;</code>. but the error occurred as follows:</p>
  <pre><code>Warning: PHP Startup: Unable to load dynamic library 'mcrypt' (tried: C:\xampp\php\ext\mcrypt
  </code></pre>
  <p>so, I commented out mcrypt extension in php.ini. &quot;php -r &quot;echo OPENSSL_VERSION_TEXT;&quot;&quot; worked resulting &quot;OpenSSL 1.1.0h  27 Mar 2018&quot;.</p>