如何使用PHP在Linux上管理(检查是否安装,停止,启动,重启)服务/软件? [关闭]

What I want to do with PHP on a Linux system:

  • Check if software is installed (e.g. Redis)
  • Start/Stop/Restart the service/software (like systemctl start|stop|restart redis.service)

This should be done by means of a graphical GUI with PHP backend.

Is there any convenient PHP-library suited for managing software on Linux, which also checks which distribution you use and adapts to the specifics of the used distribution, or do I have to use shell_exec() function in conjunction with shell commands to manage installed services?

What is the best way to achieve this with PHP?

Like you said in your question, I use shell_exec for this :

<?php
$output = shell_exec('service apache2 status');
var_dump($output);
?>

// Output : ... Active: active (running) ...