I need to change the server date by running a bash script called by php. When i invoke the bash script from shell it works, but if i call it via php then it doesn't work. The bash script is run as root.
php script code:
<?php
$time = $_POST['input_time'];
$command = "/home/tutul/bin/timetest.sh";
$output=system("$command $time");
echo "$output";
?>
bash script code:
#! /bin/sh
date $1
hwclock --systohc --utc
What am i doing wrong here?
I tried to run it on my local machine when logged in as root, so i guess the script is invoked as root?