PhpProject is a simple web application built using PHP and Apache that serves a "Hello World" message from a PHP file. This project is dockerized to make it easy to deploy and run in any environment.
The basic structure of the project is as follows:
PhpProject/
│
├── index.php # PHP file that contains the main content
├── Dockerfile # Dockerfile to build the container image
└── README.md # Project documentation
To run this project locally or inside a Docker container, you need the following:
- Docker (if you want to run in a container)
- Git (to clone the repository)
Clone it using Git:
git clone https://github.com/lessalcu/PhpProject.git
cd PhpProjectTo build the Docker image, run the following command:
docker build -t lssalas/php-project .Once the image is built, run the container:
docker run -d -p 8080:80 lssalas/php-projectThe application will be available at http://localhost:8080/ and you should see the message ¡Hello world from PHP, Lesly Salas SI08!.
Note: If you encounter an error with port 8080 being already in use, you can either:
- Terminate the process occupying the port (use
taskkill /PID <PID> /Ffor Windows to stop the process), or - Run the container on a different port, such as
8081, by using the commanddocker run -d -p 8081:80 lssalas/php-project.
To download the image from Docker Hub, run:
docker pull lssalas/php-project:latestOnce the image is downloaded, run the container:
docker run -d -p 8080:80 lssalas/php-project:latestThis will start the container and the application will be available at http://localhost:8080/.
- Make sure Docker is running.
- If you have problems accessing
http://localhost:8080, verify that the port is not in use or check your firewall.
- Project developed by Lesly Salas (https://github.com/lessalcu).