I am trying to append another virtual host entry in /etc/apache2/sites-enabled/000-default.conf in ubuntu 16.04 using php. What I want is to add another entry, restart the server and check if it works as normal. Any ideas or solution will help.
But I could not use shell_exec or exec to handle this objective. I have tried these codes
return exec("gedit /etc/apache2/sites-enabled/000-default.conf 2>&1 ");
and this one
$file = '/etc/apache2/sites-enabled/000-default.conf ';
$message = "test".PHP_EOL;
return file_put_contents($file, $message, FILE_APPEND);