refactor server_engines.php, split to small function

refactor server_engines.php, split to small function