Sign inSign up

cabohorquez/holamundo-php

By cabohorquez

•Updated almost 2 years ago

A simple php hellow world in Docker

Image
Languages & frameworks
0

318

cabohorquez/holamundo-php repository overview

⁠PHP Hello World Docker Image

This repository contains a simple "Hello World" application in PHP, designed to run on Apache through Docker.

⁠Dockerfile

The Dockerfile uses the official PHP 8.2 image with Apache. It copies index.php into the Apache root directory and exposes port 80.

# Use the official PHP image with Apache
FROM php:8.2-apache

# Copy the index.php file to the Apache server root
COPY index.php /var/www/html/

# Expose port 80
EXPOSE 80

# Start Apache in the foreground
CMD ["apache2-foreground"]
⁠PHP Code - index.php
<?php
// Enable PHP error reporting
ini_set('display_errors', 1); 
error_reporting(E_ALL);

// "Hello, World!" message
echo "¡Hola, Mundo!";
?>

⁠How to Use the Docker Image

  1. Pull the Image from Docker Hub

    docker pull cabohorquez/holamundo-php
    
  2. Run the Docker Container

    docker run -p 80:80 cabohorquez/holamundo-php
    
  3. Access the Application Open your browser and navigate to http://localhost. You should see the message ¡Hola, Mundo! displayed on the screen.

⁠Additional Notes

  • Make sure Docker is installed and running.
  • The application runs on port 80. You may change the port mapping if needed.

⁠Files Ignored (.dockerignore)

The following files are ignored in the build:

  • *.log
  • *.md

Tag summary

Content type

Image

Digest

sha256:6186e63dc…

Size

169.1 MB

Last updated

almost 2 years ago

docker pull cabohorquez/holamundo-php