Yii v2 snippet guide II

Comparing #3 with #4

Revision #4 was created by rackycz rackycz on Sep 2, 2020, 5:44:03 AM.

mssql

Content

[...]
- [https://www.yiiframework.com/wiki/250/yii-for-beginners](https://www.yiiframework.com/wiki/250/yii-for-beginners)
- [https://www.yiiframework.com/wiki/462/yii-for-beginners-2](https://www.yiiframework.com/wiki/462/yii-for-beginners-2)

**Connection to MSSQL**
---
You
mightwill need MSSQL drivers in PHP. Programatically you can list them or test their presence like this:
 
 
```php
 
var_dump(\PDO::getAvailableDrivers());
 
 
if (in_array('sqlsrv', \PDO::getAvailableDrivers())) {
 
  // ... MsSQL driver is available, do something
 
}
 
```
 
 
Based on your system you have to download different driver. The differences are x64 vs x86 and ThreadSafe vs nonThreadSafe. In Windows I always use ThreadSafe.
[Explanation](https://www.php.net/manual/en/faq.obtaining.php#faq.obtaining.threadsafety).

Newest PHP drivers are [here](https://docs.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server).
- Drivers v5.8 = PHP 7.2 - 7.4
[...]