user
Description:
string Worker::$user
Sets the user under which the current Worker instance runs. This property only takes effect when the current user is root. If not set, it runs as the current user by default.
It is recommended to set $user to a user with lower permissions, such as www-data, apache, nobody, etc.
Note: This property must be set before Worker::runAll(); is executed to be effective. This feature is not supported on Windows systems.
Example
use Workerman\Worker;
require_once __DIR__ . '/vendor/autoload.php';
$worker = new Worker('websocket://0.0.0.0:8484');
// Set the running user for the instance
$worker->user = 'www-data';
$worker->onWorkerStart = function($worker)
{
echo "Worker starting...\n";
};
// Run the worker
Worker::runAll();