{"id":13405462,"url":"https://github.com/php-pm/php-pm","last_synced_at":"2025-05-12T15:36:24.054Z","repository":{"id":14443059,"uuid":"17154573","full_name":"php-pm/php-pm","owner":"php-pm","description":"PPM is a process manager, supercharger and load balancer for modern PHP applications.","archived":false,"fork":false,"pushed_at":"2023-12-08T21:41:22.000Z","size":762,"stargazers_count":6560,"open_issues_count":33,"forks_count":367,"subscribers_count":228,"default_branch":"master","last_synced_at":"2024-10-29T10:22:13.279Z","etag":null,"topics":["application-server","php7","psr7","symfony"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/php-pm.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":"2014-02-24T23:25:40.000Z","updated_at":"2024-10-27T13:38:28.000Z","dependencies_parsed_at":"2022-06-26T02:30:14.294Z","dependency_job_id":"977c36b2-3a39-481b-85d5-daaefb85aefa","html_url":"https://github.com/php-pm/php-pm","commit_stats":{"total_commits":326,"total_committers":79,"mean_commits":"4.1265822784810124","dds":0.745398773006135,"last_synced_commit":"4a7b600d8939f6c7b545b0a88473010e6e37bfbd"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-pm%2Fphp-pm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-pm%2Fphp-pm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-pm%2Fphp-pm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-pm%2Fphp-pm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-pm","download_url":"https://codeload.github.com/php-pm/php-pm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250477821,"owners_count":21437049,"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":["application-server","php7","psr7","symfony"],"created_at":"2024-07-30T19:02:02.865Z","updated_at":"2025-04-23T17:20:24.739Z","avatar_url":"https://github.com/php-pm.png","language":"PHP","readme":"PPM - PHP Process Manager\n====================================================\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://avatars3.githubusercontent.com/u/11821812?v=3\u0026s=200\" /\u003e\n\u003c/p\u003e\n\nPHP-PM is a process manager, supercharger and load balancer for PHP applications.\n\n![Build Status](https://github.com/php-pm/php-pm/workflows/CS%20\u0026%20PHPStan%20\u0026%20Phpunit%20\u0026%20Integration%20Tests/badge.svg)\n[![Gitter](https://badges.gitter.im/php-pm/php-pm.svg)](https://gitter.im/php-pm/php-pm?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\nIt's based on ReactPHP and works best with applications that use request-response frameworks like Symfony's HTTPKernel.\nThe approach of this is to kill the expensive bootstrap of PHP (declaring symbols, loading/parsing files) and the bootstrap of feature-rich frameworks. See Performance section for a quick hint.\nPHP-PM basically spawns several PHP instances as worker bootstraping your application (eg. the whole Symfony Kernel) and hold it in the memory to be prepared for every\nincoming request: This is why PHP-PM makes your application so fast.\n\nMore information can be found in the article: [Bring High Performance Into Your PHP App (with ReactPHP)](https://web.archive.org/web/20190103202024/http://marcjschmidt.de/2014/02/08/php-high-performance/)\n\n### Features\n\n* Performance boost up to 15x (compared to PHP-FPM, Symfony applications).\n* Integrated load balancer.\n* Hot-Code reload (when PHP files change).\n* Static file serving for easy development procedures.\n* Support for HttpKernel (Symfony/Laravel), Drupal (experimental), Zend (experimental).\n\n### Badge all the things\n\nDoes your app/library support PPM? Show it!\n\n[![PPM Compatible](https://raw.githubusercontent.com/php-pm/ppm-badge/master/ppm-badge.png)](https://github.com/php-pm/php-pm)\n\n```\n[![PPM Compatible](https://raw.githubusercontent.com/php-pm/ppm-badge/master/ppm-badge.png)](https://github.com/php-pm/php-pm)\n```\n\n#### Use\n\n```bash\ncd into/your-application\n\n# run Symfony\ndocker run -v \"$(pwd):/var/www\" -p 8080:80 phppm/nginx --bootstrap=symfony --static-directory=web/\n\n# run Laravel\ndocker run -v \"$(pwd):/var/www\" -p 8080:80 phppm/nginx --bootstrap=laravel --static-directory=public/\n```\n\nDocker is easier to setup and maintain. If your applications requires additional environment tools or libraries,\nyou can build your own image based on ours. See [github.com/php-pm/php-pm-docker](https://github.com/php-pm/php-pm-docker) for more information.\n\nWhen `debug` is enabled, PHP-PM detects file changes and restarts its worker automatically.\n\n#### Use without Docker\n\nFollow the wiki article [Use without Docker](https://github.com/php-pm/php-pm/wiki/Use-without-Docker).\n\n#### Performance\n\nTo get the maximum performance you should usually use `--app-env=prod` with disabled\ndebug `--debug=0`. Also make sure xdebug is disabled. Try with different amount of workers.\nUsually a 10% over your cpu core count is good. Example: If you have 8 real cores (excl. hyper-threading) use `--workers=9`.\n\nTo get even more performance (for static file serving or for rather fast applications) try a different event loop (see https://github.com/reactphp/event-loop).\n\n#### Debugging\n\nIf you get strange issues in your application and you have no idea where they are coming from try\nusing only one worker `--workers=1` and enable `-v` or `-vv`. \n\nWhen debugging you should use xdebug as you're used to. If you set a break point and hold the application, then only one\nworker is stopped until you release the break point. All other workers are fully functional. \n\n**Note for XDebug and PHPStorm**: Since php-pm uses at least two processes, there are two xdebug instances as well. PHPStorm is per default configured to only accept one connection at a time. You need to increase that. You won't get xdebug working with your application if you don't increase that count.\n\n![Xdebug and PHPStorm](https://raw.githubusercontent.com/php-pm/assets/master/xdebug-phpstorm.png)\n\nIn all workers the STDOUT is redirected to the connected client. So take care, `var_dump`, `echo` are not displayed on the console.\nSTDERR is not redirected to the client, but to the console. So, for very simple debugging you could use `error_log('hi')` and you'll see it on the console.\nPer default exceptions and errors are only displayed on the console, prettified with Symfony/Debug component.\n\n### Adapter\n\n**HttpKernel for Symfony/Laravel** - https://github.com/php-pm/php-pm-httpkernel\n\n**Zend** - https://github.com/php-pm/php-pm-zend\n\n**CakePHP** - https://github.com/CakeDC/cakephp-phppm\n\n### Command\n\n![ppm-help](https://raw.githubusercontent.com/php-pm/assets/master/help-screenshot.png)\n\n![ppm-start](https://raw.githubusercontent.com/php-pm/assets/master/start-command.png)\n\n\n#### Symfony\n\n```bash\ncd my-project\ndocker run -v `pwd`:/var/www -p 8080:80 phppm/nginx --static-directory=web/\n```\n\n#### Laravel\n\n```bash\ncd my-project\ndocker run -v `pwd`:/var/www -p 8080:80 phppm/nginx --bootstrap=laravel --static-directory=web/\n```\n\n#### Zend\n\n```bash\ncd my-project\ndocker run -v `pwd`:/var/www -p 8080:80 phppm/nginx --bootstrap=Zf2\n```\n\n#### Wordpress\n\nFor all Wordpress lovers out there: PPM is not going to work with Wordpress due to the lack of request-response abstraction.\nWe highly doubt that Wordpress is ever going to be compatible because its architecture is written in a way that makes it\ncurrently impossible to serve multiple requests in one application process.\n\n### Performance (requests/s)\n\n6x4GHz Intel i7, 16GB RAM. 10 concurrent, 1000 total request: `ab -c 10 -n 1000 http://127.0.0.1:8080/`\n\n#### Symfony, CMS application\n\n`ppm start --bootstrap=symfony --app-env=prod --logging=0 --debug=0 --workers=20`\n\nhttps://github.com/jarves/jarves\n\n| PHP Version              | Dynamic at Jarves | Static file |\n|--------------------------|-------------------|-------------|\n| 7.0.3, StreamSelectLoop  | 2387,67           | 3944,52     |\n| 5.6.18, StreamSelectLoop | 1663,56           | 2636,09     |\n| 5.6.18, LibEventLoop     | 1811,76           | 3441,72     |\n\n#### Laravel, example package\n\nhttps://github.com/bestmomo/laravel5-example\n\n`ppm start --bootstrap=laravel --app-env=prod --debug=0 --logging=0 --workers=20`\n\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/php-pm/assets/master/laravel.png\" /\u003e\n\u003c/p\u003e\n\n## Issues\n\n* Memory leaks, memory leaks and memory leaks. You will also find leaks in your application. :) But no big issue since workers restart automatically.\n* Does not work with ExtEventLoop. (So don't install `php70-event`, but you can try LibEventLoop `php56-libevent`)\n* Drupal and Zend is very experimental and not fully working. Try using https://github.com/php-pm/php-pm-drupal.\n* Laravel's debugger isn't working perfectly yet since it's still needed to reset some stuff after each request.\n* Streamed responses are not streamed yet\n* No windows support due to signal handling\n\nPlease help us fix these issues by creating pull requests. :)\n\n### Setup\n\nWe provide ready-to-use docker images you can use right away.\nIf you have own setup, see in the [PHP-PM docker repository](https://github.com/php-pm/php-pm-docker) how to integrate PHP-PM in your NGiNX setup.\n\n#### Trusted proxy Symfony\n \nTo get the real remote IP in your Symfony application for example, don't forget to add ppm (default `127.0.0.1`)\nas trusted reverse proxy.\n\n```yml\n# app/config/config.yml\n# ...\nframework:\n    trusted_proxies:  [127.0.0.1]\n```\n\nMore information at http://symfony.com/doc/current/cookbook/request/load_balancer_reverse_proxy.html.\n","funding_links":[],"categories":["PHP","Configuration","基础架构 Infrastructure","配置 Configuration","基础设施(Infrastructure)","基础框架","Developments"],"sub_categories":["Infrastructure","基础设施 Infrastructure","构建/部署","Framework \u0026 Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-pm%2Fphp-pm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-pm%2Fphp-pm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-pm%2Fphp-pm/lists"}