0

I installed Laravel and cloned a repo from my git server to use on a staging server. After installing all required tools I wanted to migrate the database. The error I now get is:

[2016-05-04 16:54:51] local.ERROR: exception 'PDOException' with message 'could not find driver' in /var/www/mfserver/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55

#1 /var/www/mfserver/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(22): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=46.1...', Array, Array)
#2 /var/www/mfserver/bootstrap/cache/compiled.php(11439): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
#3 /var/www/mfserver/bootstrap/cache/compiled.php(11435): Illuminate\Database\Connectors\ConnectionFactory->createSingleConnection(Array)
#4 /var/www/mfserver/bootstrap/cache/compiled.php(11350): Illuminate\Database\Connectors\ConnectionFactory->make(Array, 'mysql')
#5 /var/www/mfserver/bootstrap/cache/compiled.php(11305): Illuminate\Database\DatabaseManager->makeConnection('mysql')
#6 /var/www/mfserver/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php(171): Illuminate\Database\DatabaseManager->connection(NULL)
#7 /var/www/mfserver/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php(139): Illuminate\Database\Migrations\DatabaseMigrationRepository->getConnection()
#8 /var/www/mfserver/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(393): Illuminate\Database\Migrations\DatabaseMigrationRepository->repositoryExists()
#9 /var/www/mfserver/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(100): Illuminate\Database\Migrations\Migrator->repositoryExists()
#10 /var/www/mfserver/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(58): Illuminate\Database\Console\Migrations\MigrateCommand->prepareDatabase()
#11 [internal function]: Illuminate\Database\Console\Migrations\MigrateCommand->fire()
#12 /var/www/mfserver/bootstrap/cache/compiled.php(1187): call_user_func_array(Array, Array)
#13 /var/www/mfserver/vendor/laravel/framework/src/Illuminate/Console/Command.php(150): Illuminate\Container\Container->call(Array)
#14 /var/www/mfserver/vendor/symfony/console/Command/Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/mfserver/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/mfserver/vendor/symfony/console/Application.php(841): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/mfserver/vendor/symfony/console/Application.php(189): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Migrations\MigrateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/mfserver/vendor/symfony/console/Application.php(120): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/mfserver/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/mfserver/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

I installed php-mysql but I don't see why a driver is missing.

6
  • 2
    It looks like you're using a web server (like Apache or Nginx)? If so, restart that web server and try again. Commented May 4, 2016 at 17:00
  • worked perfectly fine! THX! Commented May 4, 2016 at 17:02
  • Did you configure your .env file so that it can connect to the right database ? Commented May 4, 2016 at 17:03
  • just for my learning experience: Where did you see this? Commented May 4, 2016 at 17:03
  • @sesc360 In the error log you posted, the files are located in the /var/www/ folder, which is a default path for many web servers. When installing PHP modules or making PHP configuration changes, you need to restart the web server for those changes to take effect. Commented May 4, 2016 at 17:05

1 Answer 1

0

I had faced the same issue in my Win 8.1 machine ( 64bit ), i tried almost all possible fixes based on the other answers in stackoverflow. Finally it resolved but i don't know which fix is resolved my issue. I had made the following to fix this issue.

  1. Enabled all the pdo extensions in the php.ini file ( still not working )
  2. copy and paste the php.ini file as phpForApache.ini in the same directory of my php7 ( still not working )

  3. composer uninstalled and again installed with latest php7 as it's php path ( still not working )

  4. Closed the command prompt and run the same php artisan migrate query in windows power shell ( Now it works )

Still i don't know which step fix my issue, may b you could try all these steps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.