{"id":24772551,"url":"https://github.com/mztrix/docker-php-fpm","last_synced_at":"2025-10-11T21:30:21.557Z","repository":{"id":274226460,"uuid":"922268586","full_name":"mztrix/docker-php-fpm","owner":"mztrix","description":"An ultra-lightweight Docker solution, designed for PHP-FPM performance and adaptability. Join us to build, customize, and push the boundaries of efficient PHP process management with FPM!","archived":false,"fork":false,"pushed_at":"2025-05-22T22:29:19.000Z","size":39,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"1.0","last_synced_at":"2025-05-22T23:53:04.707Z","etag":null,"topics":["customization","docker","lightweight","performance","php-fpm"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/mztrix.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":"2025-01-25T18:56:52.000Z","updated_at":"2025-05-22T22:26:52.000Z","dependencies_parsed_at":"2025-05-10T14:32:19.864Z","dependency_job_id":"63e12083-a7f0-4399-b1a9-962d81758fe3","html_url":"https://github.com/mztrix/docker-php-fpm","commit_stats":null,"previous_names":["mztrix/docker-fpm","mztrix/docker-php-fpm"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/mztrix/docker-php-fpm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mztrix%2Fdocker-php-fpm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mztrix%2Fdocker-php-fpm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mztrix%2Fdocker-php-fpm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mztrix%2Fdocker-php-fpm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mztrix","download_url":"https://codeload.github.com/mztrix/docker-php-fpm/tar.gz/refs/heads/1.0","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mztrix%2Fdocker-php-fpm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008860,"owners_count":26084518,"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-10-11T02:00:06.511Z","response_time":55,"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":["customization","docker","lightweight","performance","php-fpm"],"created_at":"2025-01-29T04:23:18.542Z","updated_at":"2025-10-11T21:30:21.352Z","avatar_url":"https://github.com/mztrix.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker FPM\n\nThis repository provides an optimized Docker image for PHP-FPM, based on **Alpine Linux**. It is designed to offer a lightweight and flexible solution for developers and system administrators deploying PHP applications in containers.\n\n## Features\n\n- **🌍 Small Footprint**: A base image of less than 38MB, promoting resource preservation and efficiency.\n\n- **🐘 PHP-FPM**: Integrated for efficient PHP process management, featuring essential PHP 8.4 packages like `php84`, `php84-fpm`, `fcgi`, and `php84-apcu`. Utilizes Unix socket mode for enhanced performance and inter-process communication.\n\n- **🛠️ Modular Configurations**: The `php.ini` file and `php-fpm.d` directory allowed for easy parameter customization.\n\n- **❤️ Healthcheck**: Includes a built-in healthcheck endpoint (`/ping`) that responds with `pong`, ensuring the container's readiness and uptime.\n\n- **🛡️ Secure Defaults**: Includes minimal packages, reducing the attack surface.\n\n## Project Structure\n\nHere is the project structure:\n\n```plaintext\n.\n├── .docker/                    # Directory for custom Docker configurations\n│   ├── php-fpm.d/              # Directory containing PHP-FPM-specific configuration files\n│   │   └── www.conf            # PHP-FPM pool configuration file for process and resource management\n│   ├── healthcheck.sh          # Script for defining health checks for containers\n│   └── php.ini                 # PHP configuration file (INI format) for customizing runtime settings\n├── compose.override.yaml.dist  # Example override file for extending or customizing Docker Compose settings\n├── compose.yaml                # Primary Docker Compose file for defining multi-container configurations\n├── Dockerfile                  # Dockerfile defining the base image and build instructions\n└── compose.yaml                # Duplicate entry — ensure only one compose.yaml exists in your structure\n```\n\n## Configuration Files Content\n\n### `php.ini`\n\nThis file provides optimized PHP settings tailored for Symfony and PHP-FPM environments. Example content:\n\n```ini\n; -------------------------\n; PHP General Configuration\n; -------------------------\nmemory_limit = 256M          ; Memory limit adapted for Symfony\nmax_execution_time = 30      ; Maximum execution time for a script\nerror_reporting = E_ALL      ; Display all error levels\ndisplay_errors = Off         ; Disable error display in production\nlog_errors = On              ; Enable error logging\nerror_log = /var/log/php/php_errors.log ; Location of the error log file\ndefault_charset = UTF-8      ; Default character set\nfile_uploads = On            ; Enable file uploads\nupload_max_filesize = 64M    ; Maximum size of uploaded files\npost_max_size = 64M          ; Maximum size for POST requests\ndate.timezone = UTC          ; Timezone\n\n; ---------------------\n; Symfony-Specific Tuning\n; ---------------------\nrealpath_cache_size = 4096k  ; Increase realpath cache size\nrealpath_cache_ttl = 600     ; Realpath cache time-to-live\nopcache.enable = 1           ; Enable OPcache\nopcache.memory_consumption = 128 ; OPcache memory size\nopcache.max_accelerated_files = 20000 ; Number of files in OPcache\nopcache.revalidate_freq = 0  ; Disable cache revalidation in production\n\n; ----------------\n; Security Settings\n; ----------------\ndisable_functions = exec, system, shell_exec, passthru, phpinfo, show_source, popen, pclose, proc_open, proc_close\nexpose_php = Off             ; Disable PHP version exposure in HTTP headers\n\n; -----------------\n; Session Management\n; -----------------\nsession.cookie_secure = On   ; Force session cookies to use HTTPS\nsession.cookie_httponly = On ; Prevent cookie access via JavaScript\nsession.use_strict_mode = 1  ; Prevent usage of invalid sessions\nsession.save_path = /var/lib/php/sessions ; Location of session files\n\n; --------------------\n; Error Handling\n; --------------------\ndisplay_startup_errors = Off ; Disable startup error display\ntrack_errors = Off           ; Disable error tracking\n```\n\n### `php-fpm.d/www.conf`\n\nThis file configures specific settings for PHP-FPM. Example content:\n\n```ini\n[global]\n; Global settings for PHP-FPM\nerror_log = /proc/self/fd/2       ; Log errors to Docker logs\nlog_level = notice                ; Log level: debug, notice, warning, error\n\n[www]\n; Pool name ('www' replaces the default 'www')\nuser = www-data                   ; Run PHP-FPM processes as this user\ngroup = www-data                  ; Run PHP-FPM processes as this group\n\n; Listen on a Unix socket for improved performance\nlisten = /var/run/php/www.sock\nlisten.owner = www-data           ; Socket file owner\nlisten.group = www-data           ; Socket file group\nlisten.mode = 0660                ; Permissions for the socket\n\n; Process Manager Settings\npm = dynamic                      ; Dynamic process management\npm.max_children = 10              ; Max number of child processes\npm.start_servers = 3              ; Number of child processes at startup\npm.min_spare_servers = 2          ; Minimum number of idle child processes\npm.max_spare_servers = 5          ; Maximum number of idle child processes\n\n; Logging Access\naccess.log = /proc/self/fd/1      ; Log access to Docker logs\naccess.format = \"%R - %m %r - %s - %C\"\n\n; Pass environment variables to PHP\nclear_env = no                    ; Pass all environment variables to PHP\n\n; Status and Ping for Healthchecks\nping.path = /ping                 ; URL to respond to for healthchecks\nping.response = pong              ; Response string for the ping path\n\n; Security Settings\nsecurity.limit_extensions = .php  ; Only allow PHP files to be executed\n```\n\n## Prerequisites\n\nThe required tools depend on your use case:\n\n- **To build and run Docker images**:\n    - **[Docker](https://docs.docker.com/get-docker/)**: Required for building and running containers.\n\n- **To use multi-container setups**:\n    - **[Docker Compose](https://docs.docker.com/compose/install/)**: Required for managing multiple containers via `compose.yaml`.\n\nEnsure you have the appropriate tool installed based on your specific objectives.\n\n---\n\n## Getting Started\n\n### Installation Instructions\n\n#### Clone the Repository\n\nStart by cloning this repository:\n\n```bash\ngit clone https://github.com/mztrix/docker-php-fpm\ncd docker-php-fpm\n```\n\n## Way to use images\n\nYou can find the pre-built Docker images for this repository on Docker Hub:\n\n[Docker Hub: mztrix/php-fpm](https://hub.docker.com/r/mztrix/php-fpm/tags)\n\n### Available Docker Images\n\n- `latest`: The most up-to-date version of the image.\n\nUse the appropriate tag based on your requirements, e.g.:\n\n```bash\ndocker pull mztrix/php-fpm:latest\n```\n---\n\n### Build an image\n\nTo build the Docker image locally, you can run:\n\n```bash\ndocker build -t mztrix/php-fpm .\n```\n\nThis command uses the `Dockerfile` in the repository to create an image named `mztrix/php-fpm`.\n\n---\n\n### Run a container\n\nYou can start the container interactively using:\n\n```bash\ndocker run -it mztrix/php-fpm /bin/sh\n```\n\nThis will give you access to a shell session inside the container.\n\n---\n\n### Using Docker Compose\n\nFor multi-container setups or simplified configurations, use Docker Compose:\n\n#### Start Services\n\n```bash\ndocker compose up -d\n```\n\n#### Stop Services\n\n```bash\ndocker compose down\n```\n\n#### Customization\n\nYou can modify `compose.override.yaml.dist` to configure environment-specific settings, such as port mappings or volume mounts.\n\n---\n\n## License\n\nThis project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for more details.\n\n---\n\n## Contribution\n\nContributions are welcome! To contribute:\n\n1. Fork this repository.\n2. Create a new branch:\n\n   ```bash\n   git checkout -b feature/my-feature\n   ```\n\n3. Commit your changes:\n\n   ```bash\n   git commit -m \"Add my feature\"\n   ```\n\n4. Push your branch:\n\n   ```bash\n   git push origin feature/my-feature\n   ```\n\n5. Open a Pull Request.\n\n---\n\n## Author\n\nCreated and maintained by [mztrix](https://github.com/mztrix). Contributions are welcome!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmztrix%2Fdocker-php-fpm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmztrix%2Fdocker-php-fpm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmztrix%2Fdocker-php-fpm/lists"}