title: Laravel 5.4 on PHP 7.0: PDO Exception - Could not find driver (MySQL)
body: <p>I have a Laravel 5.4 project on my Ubuntu 14.04 (VPS with Plesk 12.5.30). After creating the database and setted up the <strong>.env</strong> file with required information I ran <code>php artisan migrate</code> and exceptions were thrown:</p>
  
  <blockquote>
    <p><strong>[Illuminate\Database\QueryException]</strong><br>
      could not find driver (SQL: select * from information_schema.tables where table_schema = pmaramaldb and table_name = migrations)</p>
    
    <p><strong>[PDOException]</strong><br>
      could not find driver</p>
  </blockquote>
  
  <p>My <strong>.env</strong> file has:</p>
  
  <blockquote>
    <p>DB_CONNECTION=mysql</p>
    
    <p>DB_HOST=127.0.0.1</p>
    
    <p>DB_PORT=3306</p>
    
    <p>DB_DATABASE=pmaramaldb</p>
    
    <p>DB_USERNAME=user</p>
    
    <p>DB_PASSWORD=password</p>
  </blockquote>
  
  <p>I've followed most of the guides to solve this error and there wasn't any positive results:</p>
  
  <p><strong>Enabling Extension Solution:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/ndYqa.png" rel="noreferrer">PDO is enabled</a></p>
  
  <p>The <strong>php.ini</strong> file is being generated automatically, I guess this is made by Plesk. At the start of the file it says:</p>
  
  <blockquote>
    <p>; ATTENTION!<br>
    ;<br>
    ; DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,<br>
    ; SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.</p>
  </blockquote>
  
  <p>So I've tried it anyway. After that I've restarted Apache and then tried again... Didn't work.</p>
  
  <p><strong>Installing php7.0-mysql Solution:</strong> </p>
  
  <p>I've also tried to install MySQL in case is not:</p>
  
  <blockquote>
    <p>user@server:/var/www/vhosts$ sudo apt-get install php7.0-mysql</p>
    
    <p>Leyendo lista de paquetes... Hecho</p>
    
    <p>Creando árbol de dependencias</p>
    
    <p>Leyendo la información de estado... Hecho</p>
    
    <p><strong>php7.0-mysql is already the newest version.</strong></p>
    
    <p>0 actualizados, 0 se instalarán, 0 para eliminar y 67 no actualizados.</p>
  </blockquote>
  
  <p>** SQL Lite Install Solution:**</p>
  
  <p>I've also tried as <a href="https://stackoverflow.com/questions/22463614/php-artisan-migrate-throwing-pdo-exception-could-not-find-driver-using-larav">question link</a> says: <code>sudo apt-get install php5-sqlite</code> and the result was:</p>
  
  <blockquote>
    <p>user@server:/var/www/vhosts/system/maramal.io/etc$ sudo apt-get install php5-sqlite</p>
    
    <p>Leyendo lista de paquetes... Hecho</p>
    
    <p>Creando árbol de dependencias</p>
    
    <p>Leyendo la información de estado... Hecho</p>
    
    <p><strong>php5-sqlite is already the newest version.</strong></p>
    
    <p>0 actualizados, 0 se instalarán, 0 para eliminar y 67 no actualizados.</p>
  </blockquote>
  
  <p><strong>Composer Dump-autoload Solution:</strong></p>
  
  <p>It didn't work either. I've tried <code>composer dump-autoload</code> and it didn't work.</p>
  
  <p>After ran the command <code>php -i</code>:</p>
  
  <blockquote>
    <p>PDO                                                                                                                                                                                                                                       </p>
    
    <p>PDO support => enabled  </p>
    
    <p>PDO drivers =>           </p>
    
    <p>...</p>
    
    <p>PHP Version => 5.6.30-1+deb.sury.org~trusty+1</p>
  </blockquote>
  
  <p>Well, I am not sure if this has anything to do with the error, but the version shown by running <code>php -v</code> is:</p>
  
  <blockquote>
    <p>user@server: ~/path$ php -v    </p>
    
    <p>PHP 5.6.30-1+deb.sury.org~trusty+1 (cli)    </p>
    
    <p>Copyright (c) 1997-2016 The PHP Group   </p>
    
    <p>Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies<br>
        with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies             </p>
  </blockquote>