Tuesday, November 16, 2021

[SOLVED] configure php from Redhat to connect to MS SQL Server

Issue

I'm trying to deploy Moodle LMS on Redhat server with php56 and I want to connect it to another remote MS SQL server through freetds and php-mssql,How to configure them together to be able to connect the Moodle LMS to the database?


Solution

Assuming you installed all needed packages (php-mssql and freetds). You have to add an entry in /etc/freetds.conf like this:

[mydb]
       host = 10.0.0.199
       port = 1433
       tds version = 8.0
       client charset = UTF-8
       text size = 20971520

Restart httpd (service httpd restart) Then in moodle set db name to mydb and everything will work. It could be that you will have to set/disable selinux for moodle. do this temporarily in this way :

setenforce 0

Then edit /etc/selinuc/config for next boot.

Good Luck!



Answered By - Yedidia