https://github.com/deemru/php-cgi-spawner
Spawns php-cgi processes
https://github.com/deemru/php-cgi-spawner
php php-cgi php-cgi-spawner php-fpm windows
Last synced: 6 months ago
JSON representation
Spawns php-cgi processes
- Host: GitHub
- URL: https://github.com/deemru/php-cgi-spawner
- Owner: deemru
- License: mit
- Created: 2015-08-13T12:08:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-11-05T11:53:06.000Z (about 8 years ago)
- Last Synced: 2025-04-06T05:14:59.901Z (10 months ago)
- Topics: php, php-cgi, php-cgi-spawner, php-fpm, windows
- Language: C
- Homepage:
- Size: 45.9 KB
- Stars: 155
- Watchers: 6
- Forks: 28
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-cgi-spawner
[](https://ci.appveyor.com/project/deemru/php-cgi-spawner)
[php-cgi-spawner](https://github.com/deemru/php-cgi-spawner) is the smallest and easiest application to spawn a multiple `php-cgi` processes in Windows for your web server with FastCGI.
- It spawns as many `php-cgi` (x86 or x64) on a single port as you need
- It automatically restarts them if they crashed or reached `PHP_FCGI_MAX_REQUESTS`
## Basic Usage
If you have the following directory structure:
```
php-cgi-spawner.exe
php
php-cgi.exe
php.ini
```
In order to spawn 4 `php-cgi` on tcp/9000:
```
php-cgi-spawner.exe php/php-cgi.exe 9000 4
```
You may specify a config file explicitly:
```
php-cgi-spawner.exe "php/php-cgi.exe -c php/php.ini" 9000 4
```
`php-cgi.exe` processes are spawned under the same user that runs `php-cgi-spawner.exe`.
## Version 1.1
Now you can additionally specify a number of `php-cgi` helpers for permanently running `php-cgi` processes:
```
php-cgi-spawner.exe "php/php-cgi.exe -c php/php.ini" 9000 4+16
```
It means that up to 16 `php-cgi` helpers can start automatically when 4 `php-cgi` permanents do not handle a temporary server high load.
`PHP_FCGI_MAX_REQUESTS` for `php-cgi` helpers can be set in `PHP_HELP_MAX_REQUESTS`:
```
set PHP_HELP_MAX_REQUESTS=100
php-cgi-spawner.exe "php/php-cgi.exe -c php/php.ini" 9000 4+16
```
You can even do not use permanently running `php-cgi` and use just helpers, even with 1 request per helper:
```
set PHP_HELP_MAX_REQUESTS=1
php-cgi-spawner.exe "php/php-cgi.exe -c php/php.ini" 9000 0+16
```
But it is recommended to run at least 1 permanent `php-cgi` to handle opcache.
## Download
Go to [release](https://github.com/deemru/php-cgi-spawner/releases/latest) to download pre-built binary.
## Build
Go to [src](src) directory and run [make.bat](src/make.bat) in a Visual Studio environment.
## Notes
- Currently a maximum number of permanently running `php-cgi` processes is 64 because of `MAXIMUM_WAIT_OBJECTS` in `WaitForMultipleObjects`.
- The number of `php-cgi` helpers does not have such limit.