简体   繁体   English

如何在Xampp Ubuntu中启用sqlsrv-PDO驱动程序?

[英]How to enable sqlsrv - PDO drivers in xampp ubuntu?

Error : PDOException could not find driver 错误:PDOException找不到驱动程序

Actually I am facing error this while working with laravel and mssql . 其实我在使用laravel和mssql时遇到错误。

For that purpose I want enable sqlsrv in PDO drivers . 为此,我想在PDO驱动程序中启用sqlsrv。

PDO Driver PDO驱动

In this image PDO drivers contain mysql, pgsql, sqlite but not sqlsrv . 在此图中,PDO驱动程序包含mysql,pgsql,sqlite,但不包含sqlsrv。 So How I can fix it ? 那么我该如何解决呢?

I guess your PHP environment doesn't have PDO extension installed. 我猜您的PHP环境没有安装PDO扩展。

To install pdo extension, open terminal and type the below command. 要安装pdo扩展,请打开终端并输入以下命令。

First check which version of PHP is installed, to check the PHP version, type below command : 首先检查安装了哪个PHP版本,要检查PHP版本,请键入以下命令:

$ php -v

Suppose you have php7.1 installed, then to install pdo for your version type below 假设您已经安装了php7.1 ,然后在下面为您的版本类型安装pdo

$ sudo apt-get install php7.1-pdo

Restart you apache server : 重新启动您的apache服务器:

$ sudo service apache2 restart

See below snap: 参见下面的快照:

的PHP -V

After entering the command, press tab to see all the possible commands as shown in the snapshot. 输入命令后,按Tab键查看快照中所示的所有可能命令。

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

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