简体   繁体   English

如何解决PDOException?

[英]How to troubleshoot PDOException?

I am developing a Laravel application that is talking to a Microsoft SQL server. 我正在开发与Microsoft SQL Server通讯的Laravel应用程序。 Everything works, but when I run composer update to update packages I receive the following error: 一切正常,但是当我运行composer update来更新软件包时,出现以下错误:

[PDOException]
could not find driver

Script php artisan clear-compiled handling the pre-update-cmd event returned with an error

[RuntimeException]
Error Output:

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--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] [--] [<packages>]...

The strange thing is that the sqlserv driver set up in my database.php file works fine; 奇怪的是,在我的database.php文件中设置的sqlserv驱动程序运行良好; my vagrant box has the correct driver installed and configured and, as far as I can tell, everything regarding the database connection is working as expected. 我的游民箱已安装并配置了正确的驱动程序,据我所知,有关数据库连接的所有操作均按预期工作。

What steps can I take to try to narrow down the source of this error? 我可以采取哪些步骤来缩小此错误的根源?

Update : 更新

I did mention that my SQL connection is, as far as I know, configured correctly on the server: it works for querying, updating, etc. But just in case I missed something here are the full steps I took to install the SQL driver: 我确实提到,据我所知,我的SQL连接已在服务器上正确配置:它可用于查询,更新等。但是以防万一我错过了某些东西,以下是我安装SQL驱动程序的全部步骤:

  • sudo apt-get install php5-mssql php5-sybase
  • sudo php5enmod mssql
  • sudo nano /etc/freetds/freetds.conf : sudo nano /etc/freetds/freetds.conf

     [global] tds version = 8.0 client charset = UTF-8 
  • sudo service apache2 restart

I was finally able to solve this by doing the following: 我终于可以通过执行以下操作解决此问题:

  • Revert PHP 5.6 to PHP 5.5 将PHP 5.6恢复为PHP 5.5
  • Run composer update on the actual vagrant vm via ssh 通过ssh在实际的虚拟机vm上运行composer update

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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