{"id":19217084,"url":"https://github.com/8ctopus/apache-php-fpm-alpine","last_synced_at":"2025-08-21T15:32:55.952Z","repository":{"id":63226992,"uuid":"256116864","full_name":"8ctopus/apache-php-fpm-alpine","owner":"8ctopus","description":"A docker web server with Apache and php-fpm on top of Alpine Linux for php developers","archived":false,"fork":false,"pushed_at":"2025-06-16T05:18:08.000Z","size":1468,"stargazers_count":42,"open_issues_count":3,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-18T01:30:05.499Z","etag":null,"topics":["alpine-linux","apache2","composer","docker","docker-image","https","php","php-fpm","xdebug"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/8ctopus.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,"zenodo":null}},"created_at":"2020-04-16T05:21:23.000Z","updated_at":"2025-06-16T04:56:02.000Z","dependencies_parsed_at":"2023-11-15T07:28:30.425Z","dependency_job_id":"4c6b542d-8fdf-46d4-a626-600e13b74cb2","html_url":"https://github.com/8ctopus/apache-php-fpm-alpine","commit_stats":null,"previous_names":[],"tags_count":87,"template":false,"template_full_name":null,"purl":"pkg:github/8ctopus/apache-php-fpm-alpine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8ctopus%2Fapache-php-fpm-alpine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8ctopus%2Fapache-php-fpm-alpine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8ctopus%2Fapache-php-fpm-alpine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8ctopus%2Fapache-php-fpm-alpine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/8ctopus","download_url":"https://codeload.github.com/8ctopus/apache-php-fpm-alpine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8ctopus%2Fapache-php-fpm-alpine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271500361,"owners_count":24770375,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["alpine-linux","apache2","composer","docker","docker-image","https","php","php-fpm","xdebug"],"created_at":"2024-11-09T14:20:03.140Z","updated_at":"2025-08-21T15:32:55.942Z","avatar_url":"https://github.com/8ctopus.png","language":"Shell","readme":"# docker apache php-fpm alpine\n\n![Docker image size (latest semver)](https://img.shields.io/docker/image-size/8ct8pus/apache-php-fpm-alpine?sort=semver)\n![Docker image pulls](https://img.shields.io/docker/pulls/8ct8pus/apache-php-fpm-alpine)\n[image on dockerhub](https://hub.docker.com/r/8ct8pus/apache-php-fpm-alpine)\n\nApache php-fpm Alpine is a lightweight (200MB) Docker web server image that combines `Apache` HTTP Server with `PHP-FPM`, built on top of Alpine Linux. Designed specifically for PHP developers, this image offers a minimal footprint while providing a fully functional and configurable environment for PHP development and testing. It supports multiple PHP versions (including PHP 8.4), includes SSL support out of the box, and facilitates easy virtual host management. This container is ideal for rapid development workflows, offering hot reload capabilities for configuration changes and seamless integration with your local development domains.\n\n- Apache 2.4.63 with SSL\n- php-fpm 8.4.8, 8.3, 8.2, 8.1, 8.0 or 7.4\n- Xdebug 3.4.3 - debugger and profiler\n- composer 2.8.9\n- [SPX prolifer 0.4.18](https://github.com/NoiseByNorthwest/php-spx)\n- zsh 5.9\n- Alpine 3.22.0 using edge repositories\n\n## cool features\n\n- php along with the most commonly used extensions\n- Just works with any domain name\n- Support for multiple virtual hosts\n- https is configured out of the box\n- Apache and php configuration files are exposed on the host for easy editing\n- All changes to configuration files are automatically applied (hot reload)\n- Xdebug is configured for step by step debugging and profiling\n- Profile php code with SPX or Xdebug\n- Trap emails using [mailpit](https://github.com/axllent/mailpit)\n\n## getting started\n\n- download [`docker-compose.yml`](https://github.com/8ctopus/apache-php-fpm-alpine/blob/master/docker-compose.yml)\n- select php version: `8.4` is the default flavor, to use php `8.3`, `8.2`, `8.1`, `8.0` or `7.4`, select the image in `docker-compose.yml`\n- start `Docker Desktop` and run `docker-compose up`\n- open the browser at [`http://localhost/`](http://localhost/)\n- update the source code in `sites/localhost/html/public/`\n\n_Note_: On Windows [file changes notification to the container doesn't work with the WSL 2 engine](https://github.com/8ctopus/apache-php-fpm-alpine/issues), you need to use the `Hyper-V` engine. Uncheck `Use WSL 2 based engine`. What this means, is that files you update on Windows are not updated inside the container unless you use `Hyper-V`.\n\n_Note_: If you need a fully-fledged development environment, checkout the [php sandbox](https://github.com/8ctopus/php-sandbox) project.\n\n## use container\n\nStarting the container with `docker-compose` offers all functionalities.\n\n```sh\n# start container in detached mode on Windows in cmd\nstart /B docker-compose up\n\n# start container in detached mode on linux, mac and mintty\ndocker-compose up \u0026\n\n# view logs\ndocker-compose logs -f\n\n# stop container\ndocker-compose stop\n\n# delete container\ndocker-compose down\n```\n\nAlternatively the container can also be started with `docker run`.\n\n```sh\n# php 8.4\ndocker run -p 80:80 -p 443:443 --name web 8ct8pus/apache-php-fpm-alpine:2.5.1\n\n# php 8.3\ndocker run -p 80:80 -p 443:443 --name web 8ct8pus/apache-php-fpm-alpine:2.3.4\n\n# php 8.2\ndocker run -p 80:80 -p 443:443 --name web 8ct8pus/apache-php-fpm-alpine:2.1.3\n\nCTRL-C to stop\n```\n\n## access sites\n\nThere are 2 sites you can access from your browser\n\n    http(s)://localhost/\n    http(s)://(www.)test.com/\n\nThe source code is located inside the `sites/*/html/public/` directories.\n\n## domain names\n\nSetting a domain name is done by using virtual hosts. The virtual hosts configuration files are located in `sites/config/vhosts/`. By default, `localhost` and `test.com` are already defined as virtual hosts.\n\nFor your browser to resolve `test.com`, add this line to your system's host file. Editing the file requires administrator privileges.\\\n\\\nOn Windows: `C:\\Windows\\System32\\drivers\\etc\\hosts`\\\nLinux and Mac: `/etc/hosts`\n\n    127.0.0.1 test.com www.test.com\n\n## https\n\nA self-signed https certificate is already configured for `localhost` and `test.com`.\\\nTo remove \"Your connection is not private\" nag screens, import the certificate authority file `sites/config/ssl/certificate_authority.pem` to your computer's Trusted Root Certification Authorities then restart your browser.\n\nIn Windows, open `certmgr.msc` \u003e click `Trusted Root Certification Authorities`, then right click on that folder and select `Import...` under `All Tasks`.\n\nOn Linux and Mac: \\[fill blank\\]\n\nFor newly created domains, you will need to create the SSL certificate:\n\n```sh\ndocker-exec -it web zsh\nselfsign certificate /sites/domain/ssl domain.com,www.domain.com,api.domain.com /sites/config/ssl\n```\n\n_Note_: Importing the certificate authority creates a security risk since all certificates issued by this new authority are shown as perfectly valid in your browsers.\n\n## Xdebug debugger\n\nThis repository is configured to debug php code in Visual Studio Code. To start debugging, open the VSCode workspace then select `Run \u003e Start debugging` then open the site in the browser.\\\nThe default config is to stop on entry which stops at the first line in the file. To only stop on breakpoints, set `stopOnEntry` to `false` in `.vscode/launch.json`.\n\nFor other IDEs, set the Xdebug debugging port to `9001`.\n\nTo troubleshoot debugger issues, check the `sites/localhost/logs/xdebug.log` file.\n\nIf `host.docker.internal` does not resolve within the container, update the xdebug client host within `docker/etc/php/conf.d/xdebug.ini` to the docker host ip address.\n\n```ini\nxdebug.client_host = 192.168.65.2\n```\n\n## Code profiling\n\nCode profiling comes in 2 variants.\n\n_Note_: Disable Xdebug debugger `xdebug.remote_enable` for accurate measurements.\n\n## Xdebug\n\nTo start profiling, add the `XDEBUG_PROFILE` variable to the request as a GET, POST or COOKIE.\n\n    http://localhost/?XDEBUG_PROFILE\n\nProfiles are stored in the `log` directory and can be analyzed with tools such as [webgrind](https://github.com/jokkedk/webgrind).\n\n## SPX\n\n- Access the [SPX control panel](http://localhost/?SPX_KEY=dev\u0026SPX_UI_URI=/)\n- Check checkbox `Whether to enable SPX profiler for your current browser session. No performance impact for other clients.`\n- Run the script to profile\n- Refresh the SPX control panel tab and the report will be available at the bottom of the screen. Click it to show the report in a new tab.\n\n## Mailpit\n\nMailpit catches outgoing emails and displays them in a web interface.\n\n    http://localhost:8025\n\n## access container command line\n\n```sh\ndocker exec -it web zsh\n```\n\n## install more php extensions\n\n```sh\ndocker exec -it web zsh\n\napk add php82-\u003cextension\u003e\n```\n\n## extend the docker image\n\nLet's extend this docker image by adding the `php-curl` extension.\n\n```sh\ndocker-compose up --detach\ndocker exec -it web zsh\napk add php-curl\nexit\n\ndocker-compose stop\ndocker commit web apache-php-fpm-alpine-curl:dev\n```\n\nTo use newly created image, update the image reference in `docker-compose.yml`.\n\n## update docker image\n\nWhen you update the docker image version in `docker-compose.yml`, it's important to know that the existing configuration in the `docker` dir may cause problems.\\\nTo solve all problems, backup the existing dir then delete it.\n\n## build development image\n\n```sh\ndocker build -t apache-php-fpm-alpine:dev .\n```\n\n- update `docker-compose.yml` and uncomment the development image\n\n```yaml\nservices:\n  web:\n    # development image\n    image: apache-php-fpm-alpine:dev\n```\n\n## more info on php-fpm\n\n    https://php-fpm.org/about/\n\n## build the docker image\n\n_Note_: This is only for the maintainer of this project.\n\n```sh\n# build php spx module\n./php-spx/build.sh\n\n# bump version\n\n# build local image\ndocker build --no-cache -t 8ct8pus/apache-php-fpm-alpine:2.5.1 .\n\n# test local image\n\n# push image to docker hub\ndocker push 8ct8pus/apache-php-fpm-alpine:2.5.1\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F8ctopus%2Fapache-php-fpm-alpine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F8ctopus%2Fapache-php-fpm-alpine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F8ctopus%2Fapache-php-fpm-alpine/lists"}