简体   繁体   中英

How to edit apache config by php file

i've server without any control panel

and i am trying to build file that allow me to add subdomains to my site

by editing ( apache config file ) and ( named zones )

but i've no permissions to edit this files!! i am only able to read them!

my example file is

mysite.com/panel/file.php

<?

    if ( $_GET['read_httpd']){

    $content = file_get_contents ( '/etc/httpd/conf/httpd.conf' );

    if ( !empty ( $content ) )

        echo 'File Read!<br />';

        echo $content;

    }

    elseif ( $_GET['remove_named'] ){

        $delete = unlink ( '/var/named/alaa.hosts' );

        }


    elseif ( $_GET['remove_config'] ){

        $delete = unlink ( '/etc/httpd/conf/httpd.conf' );

}


?>

i've been read files successfully, but i am unable to edit !!

So, How can i allow the file to edit?

Seems like a rhetorical question, i've no permissions to edit this files, How can i allow the file to edit? .

What you could try is just leave the config files alone and if you can setup a wild-card sub-domain, use a url rewrite to route the different sub-domains to different locations / folders. The exact how-to would depend on the platform you are on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM