Property | Type | Description | |
---|---|---|---|
$appBootstrap | string | ||
$appenv | string | null | ||
$bridge | string | ||
$concurrentRequestsPerWorker | boolean | This can lead to issues when the application does not support it (like when they operate on globals at the same time) | |
$controller | |||
$controllerHost | string | ||
$debug | boolean | ||
$emergencyMode | boolean | Whether we are in the emergency mode or not. True means we need to close all workers due a fatal error and waiting for file changes to be able to restart workers. | |
$filesLastMTime | |||
$filesLastMd5 | |||
$filesToTrack | |||
$handledRequests | integer | Counter of handled clients. | |
$host | string | ||
$inReload | boolean | Whether the server is in the reload phase. | |
$inShutdown | boolean | ||
$index | integer | ||
$isRunning | boolean | Whether the server is up and thus creates new slaves when they die or not. | |
$lastWorkerErrorPrintBy | null | integer | ||
$logging | boolean | ||
$loop | React\EventLoop\LibEventLoop | React\EventLoop\StreamSelectLoop | ||
$maxRequests | integer | How many requests each worker is allowed to handle until it will be restarted. | |
$output | Symfony\Component\Console\Output\OutputInterface | ||
$phpCgiExecutable | string | Full path to the php-cgi executable. If not set, we try to determine the path automatically. | |
$port | integer | ||
$ports | string[] | $object_hash => port | |
$servingStatic | boolean | ||
$slaveCount | integer | ||
$slaves | array | ||
$tcpConnector | React\SocketClient\TcpConnector | ||
$timeout | integer | Timeout in seconds for master to worker connection. | |
$waitForSlaves | boolean | ||
$web | React\Socket\Server |
Method | Description | |
---|---|---|
__construct ( Symfony\Component\Console\Output\OutputInterface $output, integer $port = 8080, string $host = '127.0.0.1', integer $slaveCount = 8 ) | ProcessManager constructor. | |
getAppBootstrap ( ) : string | ||
getAppEnv ( ) : string | ||
getBridge ( ) : string | ||
handleSigchld ( ) | Handling zombie processes on SIGCHLD | |
isDebug ( ) : boolean | ||
isLogging ( ) : boolean | ||
isServingStatic ( ) : boolean | ||
onSlaveConnection ( |
Handles data communication from slave -> master | |
onWeb ( |
Handles incoming connections from $this->port. Basically redirects to a slave. | |
restartWorker ( ) | Closes all slaves, so we automatically reconnect. Necessary when watched files have changed. | |
run ( ) | Starts the main loop. Blocks. | |
setAppBootstrap ( string $appBootstrap ) | ||
setAppEnv ( string | null $appenv ) | ||
setBridge ( string $bridge ) | ||
setConcurrentRequestsPerWorker ( boolean $concurrentRequestsPerWorker ) | ||
setDebug ( boolean $debug ) | ||
setLogging ( boolean $logging ) | ||
setMaxRequests ( integer $maxRequests ) | ||
setPhpCgiExecutable ( string $phpCgiExecutable ) | ||
setServingStatic ( boolean $servingStatic ) | ||
shutdown ( ) | Handles termination signals, so we can gracefully stop all servers. |
Method | Description | |
---|---|---|
bootstrapFailed ( |
Handles failed application bootstraps. | |
checkChangedFiles ( boolean $restartWorkers = true ) : boolean | Checks if tracked files have changed. If so, restart all slaves. | |
commandFiles ( array $data, |
||
commandLog ( array $data, |
Prints logs. | |
commandReady ( array $data, |
A slave sent a ready commands which basically says that the slave bootstrapped successfully the application and is ready to accept connections. | |
commandRegister ( array $data, |
A slave sent a register command. | |
commandStatus ( array $data, |
A slave sent a status command. | |
getNextSlave ( $cb ) : integer | Returns the next free slave. This method is async, so be aware of async calls between this call. | |
getPort ( |
||
isConnectionRegistered ( |
Whether the given connection is registered. | |
isHeaderEnd ( string $buffer ) : boolean | Checks whether the end of the header is in $buffer. | |
newInstance ( integer $port ) | Creates a new ProcessSlave instance. | |
replaceHeader ( string $header, string[] $headersToReplace ) : string | Replaces or injects header |
protected bootstrapFailed ( |
||
$conn |
protected checkChangedFiles ( boolean $restartWorkers = true ) : boolean | ||
$restartWorkers | boolean | |
return | boolean |
protected commandFiles ( array $data, |
||
$data | array | |
$conn |
protected commandLog ( array $data, |
||
$data | array | |
$conn |
protected commandReady ( array $data, |
||
$data | array | |
$conn |
protected commandRegister ( array $data, |
||
$data | array | |
$conn |
protected commandStatus ( array $data, |
||
$data | array | |
$conn |
protected getNextSlave ( $cb ) : integer | ||
return | integer |
protected isConnectionRegistered ( |
||
$conn | ||
return | boolean |
protected isHeaderEnd ( string $buffer ) : boolean | ||
$buffer | string | |
return | boolean |
protected newInstance ( integer $port ) | ||
$port | integer |
public onSlaveConnection ( |
||
$conn |
public onWeb ( |
||
$incoming | incoming connection from react |
protected replaceHeader ( string $header, string[] $headersToReplace ) : string | ||
$header | string | |
$headersToReplace | string[] | |
return | string |
public restartWorker ( ) |
public setAppBootstrap ( string $appBootstrap ) | ||
$appBootstrap | string |
public setConcurrentRequestsPerWorker ( boolean $concurrentRequestsPerWorker ) | ||
$concurrentRequestsPerWorker | boolean |
public setPhpCgiExecutable ( string $phpCgiExecutable ) | ||
$phpCgiExecutable | string |
public setServingStatic ( boolean $servingStatic ) | ||
$servingStatic | boolean |
public shutdown ( ) |
protected bool $concurrentRequestsPerWorker | ||
return | boolean |
protected Server,PHPPM\React $controller | ||
return |
protected bool $emergencyMode | ||
return | boolean |
protected int $handledRequests | ||
return | integer |
protected bool $inReload | ||
return | boolean |
protected bool $isRunning | ||
return | boolean |
protected LibEventLoop,React\EventLoop|StreamSelectLoop,React\EventLoop $loop | ||
return | React\EventLoop\LibEventLoop | React\EventLoop\StreamSelectLoop |
protected int $maxRequests | ||
return | integer |
protected OutputInterface,Symfony\Component\Console\Output $output | ||
return | Symfony\Component\Console\Output\OutputInterface |
protected string $phpCgiExecutable | ||
return | string |
protected TcpConnector,React\SocketClient $tcpConnector | ||
return | React\SocketClient\TcpConnector |
protected int $timeout | ||
return | integer |