| Current File : /www-data/newsitesbhopal/file.php |
<?php
$host_name = "madhu.net";
if (file_exists('/vhost/$hostname.conf'))
{
echo 'file found try with diffrent name!';
}
else
{
$file = fopen("vhost/$host_name.conf", "a+");
$txt = "<VirtualHost *:80>\n";
fwrite($file, $txt);
$txt = "ServerAdmin root@$host_name \n";
fwrite($file, $txt);
$txt = "DocumentRoot /var/www/html\n";
fwrite($file, $txt);
$txt = "ServerName www.$host_name\n";
fwrite($file, $txt);
$txt = "<Directory /var/www/html>\n";
fwrite($file, $txt);
$txt = "Options Indexes FollowSymLinks\n";
fwrite($file, $txt);
$txt = "# Require all granted\n";
fwrite($file, $txt);
$txt = "AllowOverride All\n";
fwrite($file, $txt);
$txt = "</Directory>\n";
fwrite($file, $txt);
$txt = "</VirtualHost>\n";
fwrite($file, $txt);
fclose($file);
}
?>