php artisan migrate - Laravel
As soon, i press Enter 'php artisan migrate' command on ubuntu terminal. Error coming like:- [PDOException] Could Not Find Driver
I'm not able to fix this problem as i'm new to it.
Please help me to fix this issue.
I made changes in "Project-Folder-Name/config/database.php". And, it worked. Added 'unix_socket' => '/opt/lampp/var/mysql/mysql.sock',
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'DatabaseName'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => '/opt/lampp/var/mysql/mysql.sock', //Your sock got from above
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
Yo should be enable the PDO extension for you Database Manager in you php.ini
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll //In my Case the extension enable is for pgsql
;extension=php_pdo_sqlite.dll
For enable you should delete the ; char in the line of the extension restart the server and voila
I think you have a seperated configuration file (php.ini) for your CLI.
Try to execute php -i | grep php.ini
in your console. And enable the required modules in that file.
It should return something like this:
sander@sander-Laptop:~$ php -i | grep php.ini
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
As you can see it uses another php.ini file then what the phpinfo();
returns
Open that file and enable the required extensions there
so change the lines of the extensions that you require:
;extension=extension.so
to extension=extension.so
Also a tip: If you use Laravel you can use the Homestead (vagrant, virtualbox) which is an virtual machine complete preinstalled for you laravel application