Monday, May 22, 2017

Login module with laravel 5.4 and sql-server

I hope anybody can help with this problem please. I'm developing an app using laravel and sql server. So I installed all sql server drivers that php needs, also I configured my .env file and config/database file. That´s works ok, in fact when I execute a simple select query, I can get rows of a table.

But I need to add an users login module to my app. I've been reading a lot of tutorials and I found laravel works with Auth controller. So I started to activate this functionality with:

php artisan make:auth 

Ok, I got: Authentication scaffolding generated successfully.

But when I execute:

php artisan migrate  

I obtain folowing error:

[Illuminate\Database\QueryException]                                                          
  could not find driver (SQL: select * from sysobjects where type = 'U' and name = migrations)  
  [PDOException]         
  could not find driver

The extensions in php.ini file

extension=php_sqlsrv_7_nts_x64.dll
extension=php_pdo_sqlsrv_7_nts_x64.dll
extension=php_pdo_sqlsrv_7_ts_x86.dll
extension=php_sqlsrv_7_ts_x86.dll
extension=php_pdo_sqlsrv_7_ts_x64.dll
extension=php_sqlsrv_7_ts_x64.dll
extension=php_pdo_sqlsrv_7_nts_x86.dll
extension=php_sqlsrv_7_nts_x86.dll
extension=php_mysqli.dll
;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll

config/database

'default' => env('DB_CONNECTION', 'sqlsrv'),   

    'connections' => [

        'sqlsrv' => [
            'driver' => 'sqlsrv',
            'host' => env('DB_HOST', 'xxx.xx.xx.xx'),
            'database' => env('DB_DATABASE', 'DATA_BASE'),
            'username' => env('DB_USERNAME', 'user'),
            'password' => env('DB_PASSWORD', 'pass'),
            'charset' => 'utf8',
            'prefix' => '',
        ],

.env file

DB_CONNECTION=sqlsrv
DB_HOST=xxx.xx.xx.xx
DB_DATABASE=DATA_BASE
DB_USERNAME=user
DB_PASSWORD=pass

Anybody tell me please if there is anything else to configure, How can i do it?

Thanks in advance...

Edit... This is a picture of PDO library in phpinfo()

enter image description here



via user2773603

Advertisement