This image contains a Docker setup for a PHP-Apache server, designed to serve PHP applications using the Apache web server. The setup provides an easy-to-use, production-ready environment for running PHP applications with Apache, along with necessary extensions and configurations for common PHP frameworks.
Key Features:
PHP 8.3 with Apache: The server is based on the official PHP image with Apache, providing a stable and secure environment for running PHP applications.
Installed PHP Extensions: Common PHP extensions are installed, including:
GD (for image manipulation)
PDO and PDO MySQL (for database interactions)
Zip (for file compression)
Apache Configuration: The setup enables mod_rewrite for URL rewriting, a common requirement for modern PHP frameworks (e.g., Laravel, Symfony).
Customizable: The repository allows easy modification of PHP settings and Apache configuration, enabling customization to suit various PHP application requirements.
Exposed Port:
The server exposes port 80 (PORT:80), the default HTTP port used by Apache for web traffic. This allows access to the PHP application via the standard web protocol.
Directory Structure:
php_apache_server
Dockerfile # Defines the PHP-Apache Docker image
.dockerignore # Specifies files to exclude from the Docker build
index.php # Example PHP file for testing
README.md # Documentation and usage instructions
Exposed Port:
PORT:80: The Apache web server inside the container listens on port 80 by default.
This port is exposed to the host machine, allowing you to access the PHP application via http://localhost:PORT, where PORT is the host port mapped to the container’s port 80.
Usage:
Build the Docker Image:
docker build -t php_apache_server .
Run the Docker Container:
docker run -p 8080:80 php_apache_server
This will map port 80 from the container to port 8080 on your host machine. You can access the application by visiting http://localhost:8080 in your browser.
Stop the Container:
docker stop <container_id>
Example PHP File:
The repository includes a simple index.php file that displays a basic message:
This allows you to quickly verify that the server is running and serving PHP content properly.
Benefits:
Easy Setup: With the included Dockerfile, setting up a PHP-Apache server is fast and straightforward.
Scalability: This setup can be used in both development and production environments.
Customization: Easily extendable for more complex applications, frameworks, or additional PHP configurations.
This repository provides a simple yet effective base for running PHP applications on Apache, with the flexibility to modify configurations as needed for various use cases.