There are VPS with centos 7 with root access. It is necessary from time to time from the php script to execute the command there:
systemctl reload name.service What php code for this is best to use?
To run the command, you can use the php-function exec . True, there may be questions with access rights, since to execute the command you specified you will need root rights. And what rights your script has is unknown. Most likely it is launched on behalf of the Apache. Therefore, as options, it is either to use the sudo utility, or to run php itself via suexec (but then php will not work on behalf of Apache, but from the specified one).
Source: https://ru.stackoverflow.com/questions/505097/
All Articles