[英]What is the proper method for enabling MSSQL support in Laravel homestead?
我见过很多人在谈论FreeTDS和Sybase驱动程序,但我似乎无法弄清楚我需要从运行Laravel Homestead Vagrant框的Linux Web Server启用laravel / php访问MSSQL数据库。
I'm resurrecting this because it was one of the early results on google for my problem... 我正在复活这个,因为这是我谷歌问题的早期结果之一......
First, ssh into your box vagrant ssh
from the Homestead folder. 首先,从Homestead文件夹中ssh到你的box vagrant ssh
。
Then, install php5-mssql sudo apt-get update && sudo apt-get install php5-mssql
然后,安装php5-mssql sudo apt-get update && sudo apt-get install php5-mssql
For newer Vagrant with PHP 7, use sudo apt-get update && sudo apt-get install php7.0-sybase
. 对于PHP 7的新版Vagrant,请使用sudo apt-get update && sudo apt-get install php7.0-sybase
。
If this fails, you may need to do sudo apt-get upgrade
. 如果失败,您可能需要进行sudo apt-get upgrade
。
Now edit freetds.conf sudo vi /etc/freetds/freetds.conf
现在编辑freetds.conf sudo vi /etc/freetds/freetds.conf
Change the top few lines: 更改前几行:
[global]
# TDS protocol version
tds version = 7.2
client charset = UTF-8
Finally you should create a locales.conf file within /etc/freetds to allow correct parsing of dates with SQL Server, i have this configuration and has worked well with DateTime, DateTime2, SmallDateTime and Date data types: sudo vi /etc/freetds/locales.conf
最后你应该在/ etc / freetds中创建一个locales.conf文件,以便用SQL Server正确解析日期,我有这个配置,并且与DateTime,DateTime2,SmallDateTime和Date数据类型配合得很好: 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
Last, restart your server vagrant halt && vagrant up
(Just restarting nginx doesn't cause the settings to take effect.) 最后,重新启动服务器vagrant halt && vagrant up
(只需重新启动nginx不会导致设置生效。)
Source: https://laracasts.com/discuss/channels/general-discussion/sqlsrv-driver-on-linux/replies/14887 资料来源: https : //laracasts.com/discuss/channels/general-discussion/sqlsrv-driver-on-linux/replies/14887
Simple: First, ssh into your box vagrant ssh from the Homestead folder. 简单:首先,从Homestead文件夹中ssh到你的box vagrant ssh。
Command : vagrant ssh We need to install the Sybase package for enabling the support for PDO and Mssql. 命令:vagrant ssh我们需要安装Sybase软件包以启用对PDO和Mssql的支持。 Command : sudo apt-get install php7.0-sybase 命令:sudo apt-get install php7.0-sybase
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.