0

I am new in Laravel. From last 2 days i am trying to migrate database from laravel to xampp. But every time i am getting PDO Exception "Could not find driver" error. I am getting 2 error:

1 C:\xampp\htdocs\student\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
      PDOException::("could not find driver")

  2   C:\xampp\htdocs\student\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
      PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=student", "root", "", [])


could not find driver (SQL: select * from information_schema.tables where table_schema = student and table_name = migrations and table_type = 'BASE TABLE')

I searched it on stackoverflow and many other websites and got many solutions but it's not working for me. I am still getting these errors.
I also added all required extensions which i got from multiple solutions of stackoverflow it self. But still it's not working. I am attaching code whatever i did. Can anyone help me to find what i did wrong in this? Thanks in Advance!!!

2020_06_04_052746_create_student_table.php

 public function up()
    {
        Schema::create('student', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email');
            $table->string('class');
            $table->int('pnumber');
            $table->timestamps();
        });
    }

php.ini

;
extension=bz2
extension=curl
;extension=ffi
;extension=ftp
extension=fileinfo
extension=gd2
extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=ldap
extension=mbstring
extension=exif      ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
;extension=odbc
;extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop
extension=php_pdo_mysql.dll
extension=php_mysql

.env

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:v1jSrBPyR1wLOC96ePXWY0RRoTVuzNE3h+BB68RNqwI=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=student
DB_USERNAME=root
DB_PASSWORD=

after executing php --ini command

Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File:         C:\php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
Manisha
  • 175
  • 4
  • 19

2 Answers2

0

In Ubuntu/Debian you can use:

PHP5: sudo apt-get install php5-mysql
PHP7: sudo apt-get install php7.0-mysql

In Windows goto php.ini and (;)remove it from those lines:

extension=php_pdo.dll
extension=php_pdo_mysql.dll
OR:

extension=pdo.dll
extension=pdo_mysql.dll
0

I am using laragon FOR LARAVEL and was facing same problem but...

undo all the extensions except for THE

extension=pdo_mysql

Because the latest versions are encoded without the 'php_pdo_mysql & other .dll' files & are already i compiled i guess. ESPECIALLYY FOR THE {{PDO_****}} disable them & enable above code..and ';'

With doing that u can change your utf8mbg to utf8 respecitvely to both charset and collation:

inside app\config\database.php set the default to 'mysql'.

------>>app\config\database.php & set the default to 'mysql'

'mysql' => [ **** others are same just change the following]

    'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',