Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP API Docker

PHP 8.3 + Apache container with MySQL/MariaDB and MS SQL Server support. Designed for offline/air-gapped environments.

Includes

  • PHP 8.3
  • Apache web server
  • mysqli extension (MySQL/MariaDB)
  • pdo + pdo_mysql extensions
  • sqlsrv + pdo_sqlsrv extensions (MS SQL Server)
  • msodbcsql18 ODBC driver
  • mod_rewrite enabled

Quick Start (Online)

docker compose up -d --build

Access: http://localhost:8089

Offline Deployment

On a PC with internet:

# Build and export image
docker build -t php-apache-mysql .
docker save php-apache-mysql -o php-apache-mysql.tar

On offline PC:

# 1. Copy php-apache-mysql.tar and this project to the offline PC

# 2. Load image
docker load -i php-apache-mysql.tar

# 3. Put your PHP files in html/ folder
cp your-api.php html/

# 4. Start
docker compose up -d

# 5. Access
# http://PC-IP:8089/your-api.php

Configuration

Change port

Edit docker-compose.yml, change 8089:80 to your preferred port.

Add PHP files

Put all PHP files in the html/ folder. They are mounted into the container at /var/www/html.

Connect to MySQL/MariaDB

$conn = new mysqli("DB_HOST", "DB_USER", "DB_PASS", "DB_NAME");

Connect to MS SQL Server

$conn = sqlsrv_connect("DB_HOST", [
    "Database" => "DB_NAME",
    "UID" => "DB_USER",
    "PWD" => "DB_PASS"
]);
  • If database is on the same machine: use the host machine's IP (not localhost)
  • If database is in another Docker container on the same network: use the container name

Pre-built Image

Download php-apache-mysql.tar from Releases — no internet needed on the target PC.

License

MIT

About

PHP 8.2 + Apache + MySQL container for offline/air-gapped deployment

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages