{"id":26826536,"url":"https://github.com/idimsh/mphp7s","last_synced_at":"2026-04-27T16:33:07.148Z","repository":{"id":140641221,"uuid":"185081146","full_name":"idimsh/mphp7s","owner":"idimsh","description":"MPHP7 (Multi PHP 7 - Single Site) Docker Image on mod_php","archived":false,"fork":false,"pushed_at":"2020-01-05T01:17:51.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T10:28:22.367Z","etag":null,"topics":["apache2","docker","docker-image","php7","shell"],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idimsh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-05-05T20:52:09.000Z","updated_at":"2020-01-05T01:17:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"9c9dd7a1-d6e2-470f-af07-596575c32f3f","html_url":"https://github.com/idimsh/mphp7s","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/idimsh/mphp7s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idimsh%2Fmphp7s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idimsh%2Fmphp7s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idimsh%2Fmphp7s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idimsh%2Fmphp7s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idimsh","download_url":"https://codeload.github.com/idimsh/mphp7s/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idimsh%2Fmphp7s/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32345804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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":["apache2","docker","docker-image","php7","shell"],"created_at":"2025-03-30T11:19:47.068Z","updated_at":"2026-04-27T16:33:07.143Z","avatar_url":"https://github.com/idimsh.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MPHP7 Single (Multi PHP - Single Site) Docker Image on mod_php\n\n[![Total Downloads](https://img.shields.io/docker/pulls/idimsh/mphp7s?style=square)](https://hub.docker.com/repository/docker/idimsh/mphp7s)\n[![MicroBadger Layers](https://img.shields.io/microbadger/layers/idimsh/mphp7s/latest)](https://hub.docker.com/repository/docker/idimsh/mphp7s)\n[![MicroBadger Image Size](https://img.shields.io/microbadger/image-size/idimsh/mphp7s/latest)](https://hub.docker.com/repository/docker/idimsh/mphp7s)\n\n\n## Why\nI am a fan of mod_php with Apache and not much into PHP-FPM, in this image \nNginx works as reverse proxy to Apache instances which run a specific \nversion of PHP using mod_php.\n\n## Purpose\nTo host a single web-application with the desired PHP version and to be \nable to change the PHP version from the project (web project) document \nroot via config file. \nThe configuration for Nginx is generated automatically.\n\n## Structure\nThe image is based on Ubuntu 18.04 and runs Nginx on port 80 which works as \nrevers proxy.  \n3 Apache instances run on different ports for 3 versions of \nPHP: 7.1, 7.2, 7.3, 7.4.  \nEach apache instance operates mod_prefork and listens on \nports: 83, 84, 85, 86 \nrespectively, each of which uses a different mod_php version.  \n  \nA main directory which contains the web application is supposed to \nbe mounted to the container r/w to '/srv/' directory which is the \nmain DocumentRoot.\n\n## Features:  \nIn addition to most of the commonly used PHP extensions from Ubuntu,\nThe following extra PHP Extensions are available:\n- xdebug\n- inotify\n- ev\n- apcu\n- memcached\n- mongodb\n- igbinary\n- redis\n- swoole\n  \nAnd they are all compiled (by default) using `pecl` when the image was created.\n\nThe compilation of extension is controlled by build argument (`--build-arg`) `BUILD_EXTENSIONS` which is a space separated list of extension names to be installed for every PHP version.    \n\n\n## Environment variables:\n`PHP_VERSION`: (default: 7.4) The version of PHP which serves the website \nand which runs the cli 'php' command.  \nSupported values: 7.1, 7.2, 7.3, 7.4 \n  \n`DOCROOT`: (default: \".\") Must me set, it is the relative path inside `'/srv/'`\ndirectory which will be the document root.\n  \n`LOG_TO_SRV`: (default: \"0\") If set to non \"0\", the log files of Apache, Nginx, and PHP will reside in `/srv/system/log/`\ndirectory where each service will have a subdirectory there, otherwise they will be in the default '/var/log/' inside the container.  \nFurther tests on permissions need to be conducted on Linux docker hosts.  \n\n## Running:\nTo run and auto start all services:  \n`docker run -it idimsh/mphp7s:latest`  \n  \nIt will execute the default supervisor command which starts all services.  \nPressing Ctrl+C in the running container will kill supervisor and \nservices running then terminate the container.  \n  \nOr go to shell by  \n`docker run -it idimsh/mphp7s:latest /bin/bash`  \n  \nThen execute:  \n`run.sh`  \nTo get supervisor running in the foreground. Pressing Ctrl+C will kill \nsupervisor but keep all services running and return to shell.  \n  \n#### Note\nSupervisor is not really *controlling* the processes, it just call the start\n`service` or `init.d` command, I did not build commands to control Apache or\nNginx using supervisor (to support auto reload, exit status monitoring, \nsignals, ...). The implementation of supervisor is simple.  \n  \n##### Full command:\n`docker run --rm -it -v .:/srv --hostname d1.mphp7s.loc -e PHP_VERSION=7.2 -e DOCROOT=public -e LOG_TO_SRV=1 -p 8080:80 idimsh/mphp7s:latest`  \n  \n`-v .:/srv`: mounts current directory to base directory '/srv/' (which must be '/srv').  \n`--hostname d1.mphp7.loc`: Set host name of the container to a FQDN which reduces Apaches' startup warnings.  \n`-e PHP_VERSION=7.2`: Set PHP version to 7.2.  \n`-e DOCROOT=public`: Set the serving docroot to '/srv/public/', it is a relative directory.  \n`-e LOG_TO_SRV=1`: Write log files for services to '/srv/system/log/'.  \n  \n## Controlling PHP version from PHP Project:  \nIn the mounted DocRoot to '/srv/', a file named: 'php-version' is read and\nthe first line of it controls the PHP version, supported values: 7.1, 7.2, 7.3, 7.4.  \n  \nThe existence of this file overrides the PHP version passed in environment \n(`-e` param), moreover: this file is constantly being monitored for changes\nusing `incron` daemon from the container and any changes to it will cause\nthe Nginx server to reload and serve the changed PHP version.  \nFor this to work however, the file '/srv/php-version' should exists when \nthe container is starting. (i.e: it is not monitored for creation).  \n\n## Building from Dockerfile:\nBuild locally by cloning the repository\n```bash\ngit clone git@github.com:idimsh/mphp7s.git .\ncd mphp7s\ndocker build -t \"idimsh-mphp7s:latest\" .\n```  \nThis will build the image with all extra PHP extensions (the default ones) which are: `xdebug inotify ev apcu memcached mongodb igbinary redis swoole`  \n  \nTo build with custom extensions:\n```bash\ndocker build -t \"idimsh-mphp7s:latest\" --build-arg BUILD_EXTENSIONS=\"apcu\" .\n```  \nThis will build only with `acpu` extension\n\n## Comsuming the image from docker-compose:  \nHere is an example of docker-compose.yaml\n```docker\nversion: '3.5'\nservices:\n  my-web:\n    image: idimsh/mphp7s:latest\n    container_name: my-web\n    hostname: my-web.loc\n    args:                                                                      \n        BUILD_EXTENSIONS: 'apcu memcached'\n    environment:\n        PHP_VERSION: 7.3\n        DOCROOT: public\n    ports:\n      - '8082:80'\n    volumes:\n      - '.:/srv:rw'\n    networks:\n      default:\n        aliases:\n          - my-web\n          - my-web.loc\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidimsh%2Fmphp7s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidimsh%2Fmphp7s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidimsh%2Fmphp7s/lists"}