{"id":15026449,"url":"https://github.com/evilwizardcreations/php7.4-apache-docker-example","last_synced_at":"2026-02-04T17:32:05.995Z","repository":{"id":65778171,"uuid":"599246205","full_name":"EvilWizardCreations/php7.4-apache-docker-example","owner":"EvilWizardCreations","description":"A base PHP 7.4 Apache 2 image for simulating some current production environments","archived":false,"fork":false,"pushed_at":"2023-03-09T19:09:56.000Z","size":38,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T03:14:35.316Z","etag":null,"topics":["apache2","development","docker","docker-compose","docker-container","docker-image","dockerfile","dockerhub-image","legacy","legacy-application","legacy-support","php74"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/ewc2020/web/tags","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EvilWizardCreations.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-08T18:49:28.000Z","updated_at":"2023-03-11T15:36:13.000Z","dependencies_parsed_at":"2024-09-28T20:00:27.369Z","dependency_job_id":"3a384a77-e03d-47ed-b18b-15b5eb3718dc","html_url":"https://github.com/EvilWizardCreations/php7.4-apache-docker-example","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/EvilWizardCreations/php7.4-apache-docker-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fphp7.4-apache-docker-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fphp7.4-apache-docker-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fphp7.4-apache-docker-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fphp7.4-apache-docker-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvilWizardCreations","download_url":"https://codeload.github.com/EvilWizardCreations/php7.4-apache-docker-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fphp7.4-apache-docker-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262885358,"owners_count":23379579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache2","development","docker","docker-compose","docker-container","docker-image","dockerfile","dockerhub-image","legacy","legacy-application","legacy-support","php74"],"created_at":"2024-09-24T20:04:29.451Z","updated_at":"2026-02-04T17:32:05.954Z","avatar_url":"https://github.com/EvilWizardCreations.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP 7.4 \u0026 Apache Dockerfile Example\n\nA base PHP 7.4 Apache 2 image[^docker_pull_cmd_note] for demonstrating legacy projects available at [EWC Docker Hub](https://hub.docker.com/r/ewc2020/web).\n\nAn old version of ***PHP*** that some codebase sites still require to emulate a ***production*** environment to run in.\n\nOther Packages Included:\n\n- Node v14.x\n- Composer v1.10.1\n- libxml2-dev\n- libzip-dev\n- libyaml-dev\n- zip\n- unzip\n- git\n- nodejs\n- default-mysql-client\n- vim\n- npm i npm@`$NPM_VERSION`[^npm_version_note] -g\n- yaml\n\nPHP Extensions:\n\n- gettext \n- mysqli \n- pdo_mysql \n- zip\n- yaml\n\n## Build Image\n\nBuild the ***Docker Image*** without using ***cached*** versions of previous image build stages.\n\n```bash\nsudo docker build \\\n    -f php-7-4-apache.Dockerfile \\\n    --target php-7-4-build \\\n    --build-arg APP_ENV=local \\\n    --build-arg NPM_VERSION=7.24.2 \\\n    --no-cache \\\n    -t php-7-4-web-server:latest \\\n    .\n```\n\n**N.B.**\n\n- Using `-f php-7-4-apache.Dockerfile`\n\n    To specify the *filename* to ***build*** otherwise it is expected to be named `Dockerfile`.\n\n- Using `--target php-7-4-build`\n\n    To select the ***build target stage***[^multi_stage_builds_note] from the *Dockerfile*.\n    \n- Using `--build-arg ARG=value`\n\n    To set build argument values to use.\n\n### Create A Container\n\nThis creates a named container and attaches it to the ***host network*** and may cause port conflict if the host machine is already listening on any exposed ports from the ***Docker Image*** being used.\n\n```bash\nsudo docker run \\\n    -d \\\n    --network host \\\n    -v \"$(pwd)\"/public_html:/var/www/html \\\n    --name php-7-4-web-server \\\n    php-7-4-web-server\n```\n\n**OR**\n\nThis creates a named container and attaches it to the ***bridge network*** and allows for ***port forward mapping*** from the ***host*** to the ***Container***.\n\n```bash\nsudo docker run \\\n    -d \\\n    --network bridge \\\n    -p 8080:80/tcp \\\n    -v \"$(pwd)\"/public_html:/var/www/html \\\n    --name php-7-4-web-server \\\n    php-7-4-web-server\n```\n\n**N.B.**\n\n- Using `-v \"$(pwd)\"/public_html:/var/www/html`\n\n    To ***Volume Mount*** the folder `public_html` from the current folder to `/var/www/html` on the ***running*** container. It is where ***Apache*** serves the content from \u0026 allows for *realtime* change updates.\n\n- Using `-p 8080:80/tcp` \n\n    To map port **8080** on the ***Host*** machine to port **80** on the ***Container*** using the ***bridge network***.\n\n- Using `--name php-7-4-web-server`\n\n    To name the ***Container*** being created.\n\n### Start Container\n\n```bash\nsudo docker start php-7-4-web-server\n```\n\n### Stop Container\n\n```bash\nsudo docker stop php-7-4-web-server\n```\n\n## Docker Compose\n\nA `docker-compose` configuration file is included to simplify the build \u0026 deployment of the image.\n\n### Build - No Cache\n\nThis is only necessary when completely rebuilding the image to make sure all parts are rebuilt[^compose_name_note].\n\n```bash\nsudo docker-compose build --no-cache php-7-4-web-server\n```\n\n### Build \u0026 Up\n\nThis will try to use a local version or rebuild the image with current context.\n\n```bash\nsudo docker-compose up --build -d\n```\n\n## Connect To Container\n\n```bash\nsudo docker exec -it php-7-4-web-server /bin/bash\n```\n\n# Disclaimer\n\nThis Apache2 + PHP 7.4 build environment should ***NOT*** be used anywhere near a ***production*** environment. This build is for showcasing legacy systems that simple would not run in modern environments \u0026 as such it is littered with security holes and exploitation's.\n\n[^docker_pull_cmd_note]: Use `docker pull ewc2020/web:php-7.4-apache` to get a copy of the image.\n\n[^npm_version_note]: Uses a `.env` ***build-arg*** called ***NPM_VERSION*** to specify the npm version.\n\n[^multi_stage_builds_note]: Used mostly in ***Multi Stage*** image builds.\n\n[^compose_name_note]: The `php-7-4-web-server` container name to build the image for.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilwizardcreations%2Fphp7.4-apache-docker-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevilwizardcreations%2Fphp7.4-apache-docker-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilwizardcreations%2Fphp7.4-apache-docker-example/lists"}