简体   繁体   中英

PdoException when Updating composer, could not find driver

I am trying to update php composer, but am receiving the error below:

I attempted to fix it by installing pd_mysql, but that didn't work:

sudo apt-get install php5-gd php5-mysql

How can I update my composer?

jon@debian:~/NetBeansProjects/xxx$ php composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Generating autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache


  [Doctrine\DBAL\Exception\DriverException]              
  An exception occured in driver: could not find driver  



  [Doctrine\DBAL\Driver\PDOException]  
  could not find driver                



  [PDOException]         
  could not find driver  


Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception


  [RuntimeException]                                                         
  An error occurred when executing the "'cache:clear --no-warmup'" command:  

    [Doctrine\DBAL\Exception\DriverException]                                
    An exception occured in driver: could not find driver                    


    [Doctrine\DBAL\Driver\PDOException]                                      
    could not find driver                                                    


    [PDOException]                                                           
    could not find driver                                                    

  .                                                                          


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

Here is the solution.

My php version was 7.0, which was installed using:

sudo add-apt-repository ppa:ondrej/php-7.0
sudo apt-get update
sudo apt-get install php7.0

(source https://www.colinodell.com/blog/2015-12/installing-php-7-0-0 )

I then ran

sudo apt-get install php7.0-mysql

Following that, the update worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM