I am on Debian, with no sudo commands. I try to write a php script to create virtual hosts: ex:
file_put_contents("/etc/apache2/sites-available/{$newDomain}.conf", $content);
php runs under apache mod as www-data user and of course I am not enable to write in /etc/apache2/sites-available
failed to open stream: Permission denied
I have many other commands that I can execute through php-cli when loggedon as root and that I cannot execute through the browser.
$cmd = "service apache2 restart";
shell_exec($cmd);
Any idea on how to execute them as root ?
Regards