I want to work on a custom linux hosting control panel based on my experience in managing LEMP/LAMP stack. This is just a pet project. I believe I have ran into some hurdle.The CP is being written in PHP and server by NginX as default server on port 8000.I am not using any framework, just vanilla PHP.In putty, logged in as root, I can get the system uuid like this:[root@localhost ~]# dmidecode -s system-uuid997C4DE8-213B-4ACC-8E23-01E79D6CC12FWhen I try this in PHP with the following script:var_dump(shell_exec('dmidecode -s system-uuid 2>&1'));I get the following:sh: dmidecode: command not foundHow can I execute that above command get the output in PHP?Nginx/PHP-FPM is running as user nginx. Do i need to add nginx user to root group?I want to be able to execute very specific commands like: /etc/init.d/php-fpm restart from my control panel (to restart php-fpm gateway).How can I achieve this? What are my options? How does control panel like cPanel, DirectAdmin, etc... do it?I have tried the following method also. Installed sudo and used the sudo visudo command and added the following lines at the end:nginx    ALL=(ALL)    NOPASSWD:/path/to/php_shell.shDefaults:nginx        !requirettyand the content of php_shell.sh is:#!/bin/bashdmidecode -s system-uuidNow, I tried to execute it like this:var_dump(shell_exec('sudo sh /path/to/php_shell.sh 2>&1'));I get: sudo: no tty present and no askpass program specified
Custom Linux Hosting Control Panel in PHP - running commands as root
linux;centos;php;nginx