Php modifies the system time does not work

now you need to modify the operating system time with PHP. The system is currently centos

.

my code

<?php
//$cmd = "date -s "20181123 08:00:00"";
//$cmd = "timedatectl set-time 2018-11-23 08:00:00";
$cmd = "reboot";
echo date("Y-m-d H:i:s")."<br/>";
$output = shell_exec($cmd);
shell_exec("hwclock --systohc --localtime");
shell_exec("clock w");
echo "
";
echo $output;
echo "========================"."<br/>";
echo date("Y-m-d H:i:s")."<br/>";
?>

the situation in the process

first I have confirmed that the server can execute the function shell_exec. For example, there is no problem with executing shell_exec ("ls-a").
neither changing the system time nor rebooting the system seems to work.

the bosses who want to know can help to see or analyze what the problem is.

Jan.17,2022

under what permissions does your PHP container run?


what does your reboot mean? The
operating system has been rebooted. Can the following statements still be executed?

Menu