Methods |
public
static
|
getMemoryLimit(): int
Get the configured memory_limit, in bytes
Get the configured memory_limit, in bytes
|
#
|
public
static
|
getMemoryUsagePercent(): float
Get the current memory usage of the script as a percentage of the
configured memory_limit
Get the current memory usage of the script as a percentage of the
configured memory_limit
|
#
|
public
static
|
getCpuUsage(): array{int, int}
Get user and system CPU times for the current run, in microseconds
Get user and system CPU times for the current run, in microseconds
Returns
[ <user_time>, <system_time> ]
|
#
|
public
static
|
getProgramName(?string $parentDir = null): string
Get the filename used to run the script
Get the filename used to run the script
Use $parentDir to get the running script's path relative to a parent
directory.
Throws
|
#
|
public
static
|
getProgramBasename(string ...$suffix): string
Get the basename of the file used to run the script
Get the basename of the file used to run the script
Parameters
...$suffix |
Removed from the end of the filename.
|
|
#
|
public
static
|
getTempDir(): string
Get the directory PHP uses for temporary file storage by default
Get the directory PHP uses for temporary file storage by default
Throws
RuntimeException |
if the path returned by
{@see sys_get_temp_dir()} is not a writable directory.
|
|
#
|
public
static
|
getUserId(): int|string
Get the user ID or username of the current user
Get the user ID or username of the current user
|
#
|
public
static
|
isRunningAsRoot(): bool
Check if the script is running as the root user
Check if the script is running as the root user
|
#
|
public
static
|
isProcessRunning(int $pid): bool
Check if there is a running process with the given process ID
Check if there is a running process with the given process ID
|
#
|
public
static
|
escapeCommand(non-empty-array<string> $args): string
Escape and implode a command line for use in a shell command
Escape and implode a command line for use in a shell command
This method should not be used to prepare commands for
{@see proc_open()}. It is intended for use with {@see popen()} and
{@see File::openPipe()}.
|
#
|
public
static
|
isWindows(): bool
Check if the script is running on Windows
Check if the script is running on Windows
|
#
|
public
static
|
handleExitSignals(): bool
Make a clean exit from the running script on SIGTERM, SIGINT or SIGHUP
Make a clean exit from the running script on SIGTERM, SIGINT or SIGHUP
Returns
false if signal handlers can't be installed on this
platform, otherwise true .
|
#
|