This project is a simple web application demonstrating the basic structure of a PHP application connected to a SQL database.
This is just a simple setup, and doesn't contain any security best practice, just use as reference and becareful to copy-paste to production environment.
- Dockerfile shouldn't use
root
user- MSSQL18 cmd required encryption layer
This README is generated by Gemini AI, and revised by me. It might contains mistake, read it carefully.
https://gist.github.com/xenogew/3440d323b00e1d661966f2b2ca3ef64a
- To provide a demo of minimal setup example of a PHP application.
- To show how to connect PHP to a Microsoft SQL Server database.
- To serve as a starting point for building more complex web applications using this stack.
- Ensure you have Docker and Docker Compose installed.
- Navigate to the project root directory in your terminal.
- Run
docker compose up --build
to build the images and start the containers (PHP web server and SQL Server). - The PHP application should be accessible at
http://localhost:8080
. - The SQL Server database will be running and accessible from the PHP container.
/
Demo of MSSQL Connection and Query./about.php
containsphpinfo()
page you can check installtion of MSSQL extensions here.
src/
: Contains the PHP source files (index.php
,about.php
).mssql/
: Contains Dockerfile and scripts for setting up the SQL Server database (Dockerfile
,configure-db.sh
,entrypoint.sh
,setup.sql
).php/
: Contains the Dockerfile for the PHP web server.compose.yaml
: Defines the services (PHP and SQL Server) and their configuration using Docker Compose.default.conf
: Nginx configuration file for the PHP service..idx/dev.nix
: Development environment configuration (for specific IDE setups)..vscode/
: VS Code configuration files.CREDITS.md
: Project credits.
- Modify the PHP files in
src/
to change the application logic. - Update the
mssql/setup.sql
file to modify the database schema or seed data. - Adjust
compose.yaml
to change service configurations, ports, etc. - Customize
.idx/dev.nix
for your development environment setup (if using Nix).