0

I am new to Docker. How can I connect the Microsoft SQL server driver. Here is my docker-compose.yml:

version: '3.3'
services:
 web:
  image: php:7.3-apache
  container_name: php73
  volumes:
   - ./site1/site:/var/www/html/site
  ports:
   - 1111:80

Until now, Apache and PHP works great and I can test it through phpinfo()

I need to upload for testing a website in this container so I need to connect SQL Server driver with this container. How could I implement this? Is there any code to put in docker-compose.yml or should I build another container? And how could I connect the sql server driver with the php?

Note! I need only to connect the sqlsrv driver with the container

Software Engineer
  • 15,457
  • 7
  • 74
  • 102
  • 1
    Does this answer your question? [How to install pdo driver in php docker image?](https://stackoverflow.com/questions/37526509/how-to-install-pdo-driver-in-php-docker-image) – AymDev May 31 '21 at 13:05
  • Of course I did search! I found how to connect mysql but not sqlsrv – Nick Zagkanas May 31 '21 at 14:28
  • Does https://laravel-news.com/install-microsoft-sql-drivers-php-7-docker or https://stackoverflow.com/questions/59845502/howto-connect-with-php-to-a-ms-sql-server-within-a-docker-setup help you? – Saeed May 31 '21 at 14:35

1 Answers1

-1

Finally I followd the instructions of this https://laravel-news.com/install-microsoft-sql-drivers-php-7-docker. Thanks @Saeed.

Although it seems weird because I tried this guide many times before without result but this time it worked. Don't ask me why.

Thanks for the support :)