I am trying to connect Laravel 11 to Microsoft Azure SQL Server on Mac OS Sonoma M1
Before I try to install Microsoft Azure SQL Server Edge (as Microsoft SQL Server alternative for Mac OS with M1 Chip) on Docker, I follow tutorial from https://dev.to/avwerosuoghene/installing-ms-sql-server-on-mac-m1-chip-30d0 step by step until success and now its works fine.
also after I test connection using terminal with command
mssql -u SA -p MyPassword
its connected and works fine.
then I try to download Azure Data Studio as GUI Interface for the SQL Server Database, then I try to connect via that GUI, again its connected successfully and works fine.
by the way the computer name is afb6f21ec9ac as you can see on the above picture, and also if I run the command on terminal: docker ps
I have install the Microsoft Driver for PHP 8.2.0 for SQL Server on Mac (SQLSRV & PDO_SQLSRV) using this tutorial: https://github.com/Braineee/microsoft-driver-on-mamp-for-mac/blob/master/README.md, until successfully done and its works fine.
we can see using phpinfo() if SQLSRV & PDO_SQLSRV are installed successfully
then I try to connect the SQL Server (Azure Edge) with the Laravel 11
and here is my DB Connection Configuration on .env
DB_CONNECTION=sqlsrv
DB_HOST=localhost
DB_PORT=1433
DB_DATABASE=MyDatabase
DB_USERNAME=SA
DB_PASSWORD=MyPassword
but when I try to show the DB or migrate the database using php artisan command to test the connection between Laravel 11 and SQL Server (Azure) on Docker, its ERROR !! and give me Some ERROR MESSAGE !!
FYI, I am using:
- PHP 8.2.0
- Mamp Pro 6.8
- Microsoft Azure SQL Server EDGE (Database)
- Microsoft Azure Data Studio 1.48.0 (GUI)
- Mac OS Sonoma 14.5 with M1 Chip
- Docker 4.30.0
- Laravel 11.8.0
- Docker Container ID: afb6f21ec9ac
- server localhost/127.0.0.1 port 1433
- DB Name: MyDatabase
- DB Username: SA
- DB Password: MyPassword
- Project Laravel Folder: MyLaravel
please help me, why I can connect the database via terminal and via Database GUI but cannot connect via laravel altough I have install Microsoft Driver For PHP 8.2.0 and SQL Server (SQLSRV & PDO_SQLSRV) ??
thanks for your help 🙂