What is the proper method to enable MSSQL support at Laravel Manor?

I've seen a lot of people talking about FreeTDS and Sybase drivers, but I can't figure out what I need to enable laravel / php access to MSSQL databases from a Linux web server that is running Laravel Homestead Vagrant box.

+3


source to share


1 answer


I am resurrecting this because it was one of the early results on google for my problem ...

First ssh into the box vagrant ssh

from the Homestead folder.

Then install php5-mssql sudo apt-get update && sudo apt-get install php5-mssql

For new Vagrant with PHP 7 use sudo apt-get update && sudo apt-get install php7.0-sybase

.

If this fails, you may need to do sudo apt-get upgrade

.

Now edit freetds.conf sudo vi /etc/freetds/freetds.conf



Change some of the top lines:

[global]
        # TDS protocol version
        tds version = 7.2
        client charset = UTF-8

      

Finally, you have to create a locales.conf file in / etc / freetds to allow correct parsing of dates from SQL Server, I have this configuration and worked well with DateTime, DateTime2, SmallDateTime and Date types: sudo vi /etc/freetds/locales.conf

[default]
    date format = %Y-%m-%d %H:%M:%S.%z

[en_US]
    date format = %b %e %Y %I:%M:%S:%z%p
    language = us_english
    charset = iso_1

[es_ES]
    date format = %b %d %Y %I:%M%p
    language = spanish
    charset = iso_1

[pt_BR]
    date format = %d/%m/%Y %H:%M
    language = Portuguese
    charset = iso_1

[it_IT]
    date format = %d/%m/%Y %H:%M
    language = Italiano
    charset = iso_1

      

Finally, restart the server vagrant halt && vagrant up

(Just restarting nginx does not force the settings to take effect.)

Source: https://laracasts.com/discuss/channels/general-discussion/sqlsrv-driver-on-linux/replies/14887

+7


source







All Articles