Saturday, March 4, 2023

Setup mssql using valet in MAC

To set up MS SQL in Valet on a Mac, you will need to follow these steps:

Install the required PHP extensions:

brew tap exolnet/homebrew-deprecated

For php 7.4

brew install php@7.4-mssql

For php 8.0

brew install php@8.0-mssql

Install the SQL Server driver for PHP:

pecl install sqlsrv pdo_sqlsrv

Once the SQL Server driver is installed, add the following lines to your PHP configuration file:

extension=sqlsrv.so

extension=pdo_sqlsrv.so

Install the Microsoft ODBC Driver for SQL Server:

brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release

brew install msodbcsql17

Configure Valet to use MS SQL by adding the following lines to your Valet configuration file ~/.config/valet/config.json:

json

Copy code

"mssql": {

     "port": "1433",

     "dump": false

 }

Restart Valet and you should now be able to use MS SQL in your PHP applications. To test, create a new Laravel project and try connecting to your MS SQL database.


Note: Make sure that your MS SQL server is configured to allow remote connections if you are using a remote server. 

for mac add this path to zshrc file

export PATH="$HOME/.composer/vendor/bin:$PATH"


No comments:

Post a Comment