Randy_Johnson's avatar

SQLite Driver Installed but not Seen!

Hi, my sqlite driver has just been installed and I can see it with sqlite command. When I run php artisan migrate I get this error.


  at <font color="#4E9A06">/opt/lampp/htdocs/laravel_tutorials/freecodecamp/vendor/laravel/framework/src/Illuminate/Database/Connection.php</font>:<font color="#4E9A06">664</font>
    <font color="#555753"><i>660| </i></font><font color="#C4A000">        </font><font color="#555753"><i>// If an exception occurs when attempting to run a query, we&apos;ll format the error</i></font>
    <font color="#555753"><i>661|         // message to include the bindings with SQL, which will make this exception a</i></font>
    <font color="#555753"><i>662|         // lot more helpful to the developer instead of just the database&apos;s errors.</i></font>
    <font color="#555753"><i>663|         </i></font><font color="#C4A000">catch (</font><b>Exception $e</b><font color="#C4A000">) {</font>
<span style="background-color:#CC0000"><b>  &gt; </b></span><font color="#555753"><i>664| </i></font><font color="#C4A000">            throw new </font><b>QueryException</b><font color="#C4A000">(</font>
    <font color="#555753"><i>665| </i></font><font color="#C4A000">                </font><b>$query</b><font color="#C4A000">, </font><b>$this</b><font color="#C4A000">-&gt;</font><b>prepareBindings</b><font color="#C4A000">(</font><b>$bindings</b><font color="#C4A000">), </font><b>$e</b>
    <font color="#555753"><i>666| </i></font><b>            </b><font color="#C4A000">);</font>
    <font color="#555753"><i>667| </i></font><font color="#C4A000">        }</font>
    <font color="#555753"><i>668| </i></font>

  <font color="#C4A000">Exception trace:</font>

  <font color="#06989A">1   </font><font color="#C4A000">PDOException::(&quot;could not find driver&quot;)</font>
      <font color="#4E9A06">/opt/lampp/htdocs/laravel_tutorials/freecodecamp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php</font>:<font color="#4E9A06">70</font>

  <font color="#06989A">2   </font><font color="#C4A000">PDO::__construct(&quot;sqlite:/opt/lampp/htdocs/laravel_tutorials/freecodecamp/database/database.sqlite&quot;, [])</font>
      <font color="#4E9A06">/opt/lampp/htdocs/laravel_tutorials/freecodecamp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php</font>:<font color="#4E9A06">70</font>

  <font color="#4E9A06">Please use the argument </font><font color="#CC0000">-v</font><font color="#4E9A06"> to see more details.</font>
0 likes
3 replies
saqueib's avatar

It looks like SQLite driver is not installed. You can test it by putting the following code at the top in public/index.php


$dir = 'sqlite:/database/database.sqlite';
$dbh  = new PDO($dir) or die("cannot open the database");
dd($dbh);

It should not give you cannot open the database

Randy_Johnson's avatar

Yeah, I've just done it, and just installed sqlite3. Now I am getting a new error of:

[Fri Aug 16 14:41:33 2019] PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/pdo_sqlite.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 [Fri Aug 16 14:41:33 2019] PHP Warning: PHP Startup: Unable to load dynamic library 'sqlite3' (tried: /usr/lib/php/20170718/sqlite3 (/usr/lib/php/20170718/sqlite3: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/sqlite3.so (/usr/lib/php/20170718/sqlite3.so: cannot open shared object file: No such file or directory)) in Unknown on line 0.

Please or to participate in this conversation.