Problem with the pdo_sqlite extension when creating a Laravel project in Laragon
It is important to point out that you must have at least PHP version 8.3.3 to work with Laravel 11; on my YouTube channel, I explain how you can configure Laragon with PHP 8.
For the rest, Laragon already brings us everything we need to start working on Laravel.
From the button that says ”Start All”, you start both Apache and MySQL (which you must do in order to work with Laravel); so, if you have another LAMP environment enabled on your computer, first, you must download said services and then up the service with the aforementioned button:
In addition to installing Laragon, you must enable the following "pdo_sqlite" extension:
Or when creating the project in Laravel it may stop with an error or when starting the server an error like the following:
could not find driver PRAGMA foreign_keys = ON;
And it is because you must enable the previous extension.
On linux, you can install the following dependency:
$ sudo apt-get install php-sqlite3
And it is to prevent it from throwing an error like the following:
INFO Application key set successfully.
> @php -r "file_exists('database/database.sqlite') || touch('database/database.sqlite');"
> @php artisan migrate --ansi
Illuminate\Database\QueryException
could not find driver (Connection: sqlite, SQL: PRAGMA foreign_keys = ON;)
at vendor\laravel\framework\src\Illuminate\Database\Connection.php:813
809 $this->getName(), $query, $this->prepareBindings($bindings), $e
810 );
811 }
812
813 throw new QueryException(
814 $this->getName(), $query, $this->prepareBindings($bindings), $e
815 );
816 }
817 }
In addition to installing Laragon, you must enable the following "pdo_sqlite" extension:
- Andrés Cruz
Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter