I want to connect to sql server database which is placed on a remote server while my php code has been installed on an ubuntu server. I found that it needs to install sqlsrv driver or mssql driver before connecting. How can I install the requirement(s) in advanced?
Php – install sql server driver on ubuntu
PHPsql server
Related Topic
- Windows – How to install SQL Server Driver for PHP for use with WampServer 2.0i
- Php – Why is PHP -> MSSQL very slow when the DB is not on the same machine as the PHP code
- Linux – Can pdo_sqlsrv driver be installed on Linux/Ubuntu with php 5.5.3 using pecl install pdo_sqlsrv
- Php – Ubuntu 16.04 PHP 7 & Microsoft ODBC Driver for SQL Server on Linux – odbc_connect undefined
- Linux – Installing ODBC driver 13 for MSSQL Server in Amazon Linux on EC2 instance
- PHP – Resolving sqlsrv_connect() Function Identification Issue
Best Answer
Install PHP extension in OS:
apt-get install php5-sybase
, restart Apache or PHP-FPM (depending on your SAPI). Make sure the newly installed PDO driver is loaded (should be enabled automatically, check for output line php5_invoke: Enable module pdo_dblib for [your SAPI here]). This will also install all dependencies. Now you can use mssql: DSNs in PDO, as presented in PHP manual.There's another PDO driver for MSSQL, but it only works under Windows.
You can also use PDO with ODBC.