更新composer时出现PdoException,找不到驱动程序

时间:2016-06-12 06:49:20

标签: php composer-php

我正在尝试更新php composer,但收到以下错误:

我尝试通过安装pd_mysql来修复它,但这不起作用:

sudo apt-get install php5-gd php5-mysql

如何更新我的作曲家?

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>]...

1 个答案:

答案 0 :(得分:0)

这是解决方案。

我的php版本是7.0,使用以下命令安装:

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

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

然后我跑了

sudo apt-get install php7.0-mysql

之后,更新工作正常。