Enabling Azure PDO DBLIB
In Scriptcase installed on Linux, we have the following driver available for connection to MSSQL Server: PDO DBLIB. If you are using your own pre-configured environment, MSSQL Server extensions must be enabled manually in PHP.
Configuring and enabling Azure PDO DBLIB on Linux
IMPORTANT: If you are using the Scriptcase automatic installer, the extensions are already enabled in PHP, all that is missing is the configuration of the freetds file. The procedure below is only for manual installations of Scriptcase. To see how to configure freetds in the automatic installation, scroll down to the configuration section by clicking here
1 - If you do not have the extension enabled you can install the extension with this command in the terminal:
sudo apt-get install php8.1-pdo-dblib
- If you are unable to execute the above command because you cannot find packages, install the repository below and update.
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
Install the basic packages using the terminal for this procedure:
| Ubuntu\Debian | RHEL\CentOS |
|---|---|
sudo apt-get install unixodbc unixodbc-dev gcc nano wget make |
sudo yum install unixODBC unixODBC-devel gcc nano wget make |
- Download and Unzip the freeTDS:
wget https://www.freetds.org/files/stable/freetds-0.95.95.tar.gz
tar -zxf freetds-0.95.95.tar.gz
- Access the freeTDS directory and run the following command to compile and install FreeTDS:
sudo ./configure --with-tdsver=7.4 --with-unixodbc=/usr --disable-libiconv --disable-static --disable-threadsafe --enable-msdblib --disable-sspi --with-gnu-ld --enable-sybase-compat && make && make install
- Edit the FreeTDS configuration file:
| Ubuntu\Debian | RHEL\CentOS |
|---|---|
sudo nano/usr/local/etc/freetds.conf |
sudo vim /usr/local/freetds/freetds.conf |
- Add your MSSQL Server connection informations, like this example:
[MSSQLServer] host = 192.18.72.03
port = 1433
tds version = 7.2
2 - Restart the Apache service via the terminal.
sudo service apache2 restart
Setting up freetds - automatic installation
1 - Edit the FreeTDS configuration file:
| Automatic installation directory | |
|---|---|
sudo nano /opt/Scriptcase/v9-php8/components/drivers/freetds/etc/freetds.conf |
` |
2 - Add your MSSQL Server connection informations, like in the example:
[MSSQLServer] host = 192.18.72.03
port = 1433
tds version = 7.4
3 - Restart Apache service
sudo service apachesc9php81 restart
Connection to Scriptcase
- PDO DBLIB: Clique aqui