Latest

Monday, July 10, 2017

Laravel - PDOException Missing Driver on Ubuntu

Asked by: Anaconda


I've developed an application in PHP using Laravel, which I now want to deploy via a VPS.

I've followed DevMarketer's Guide to deploy the application, and I've also followed This Microsoft's SQL Server Tutorial on Ubuntu.

So far, my application is appearing and executing just fine on the domain. However, upon trying to communicate with the database, I get the following error in my log.

[2017-07-10 14:11:26] local.ERROR: PDOException: could not find driver in /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68

PHP --ini

Gives me the following result:

Configuration File (php.ini) Path: /etc/php/7.0/cli
Loaded Configuration File:         /etc/php/7.0/cli/php.ini
Scan for additional .ini files in: /etc/php/7.0/cli/conf.d
Additional .ini files parsed:      /etc/php/7.0/cli/conf.d/10-opcache.ini,
/etc/php/7.0/cli/conf.d/10-pdo.ini,
/etc/php/7.0/cli/conf.d/15-xml.ini,
/etc/php/7.0/cli/conf.d/20-calendar.ini,
/etc/php/7.0/cli/conf.d/20-ctype.ini,
/etc/php/7.0/cli/conf.d/20-dom.ini,
/etc/php/7.0/cli/conf.d/20-exif.ini,
/etc/php/7.0/cli/conf.d/20-fileinfo.ini,
/etc/php/7.0/cli/conf.d/20-ftp.ini,
/etc/php/7.0/cli/conf.d/20-gettext.ini,
/etc/php/7.0/cli/conf.d/20-iconv.ini,
/etc/php/7.0/cli/conf.d/20-json.ini,
/etc/php/7.0/cli/conf.d/20-mbstring.ini,
/etc/php/7.0/cli/conf.d/20-mcrypt.ini,
/etc/php/7.0/cli/conf.d/20-odbc.ini,
/etc/php/7.0/cli/conf.d/20-pdo_odbc.ini,
/etc/php/7.0/cli/conf.d/20-phar.ini,
/etc/php/7.0/cli/conf.d/20-posix.ini,
/etc/php/7.0/cli/conf.d/20-readline.ini,
/etc/php/7.0/cli/conf.d/20-shmop.ini,
/etc/php/7.0/cli/conf.d/20-simplexml.ini,
/etc/php/7.0/cli/conf.d/20-sockets.ini,
/etc/php/7.0/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.0/cli/conf.d/20-sysvsem.ini,
/etc/php/7.0/cli/conf.d/20-sysvshm.ini,
/etc/php/7.0/cli/conf.d/20-tokenizer.ini,
/etc/php/7.0/cli/conf.d/20-wddx.ini,
/etc/php/7.0/cli/conf.d/20-xmlreader.ini,
/etc/php/7.0/cli/conf.d/20-xmlwriter.ini,
/etc/php/7.0/cli/conf.d/20-xsl.ini

SQLCMD

It may be useful to specify that when I use the following

sqlcmd -S yeah.server.windows.net -U su_root -P sup3rs3qr3t

I get a

1>

Which as I understand it means it authenticated successfully.

However, that error persists in my laravel.log file (I clear it before every run so I know I'm not seeing an old error)

I've also tried php artisan config:clear and restarting nginx etc.

config/Database.php

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

'connections' => [
'sqlsrv' => [
'driver'   => 'sqlsrv',
'host'     => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset'  => 'utf8',
'prefix'   => '',
],
];

I'd appreciate a bit of help,

thank you all in advance.



Source

No comments:

Post a Comment

Adbox