How to add host remotely

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
josepi
-


Joined: 20 Jul 2006
Posts: 30

PostPosted: Wed Aug 23, 2006 12:49 am    Post subject: How to add host remotely Reply with quote

Anyone know's about Add a Host remotely using PHP ?
Back to top View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Wed Aug 23, 2006 11:39 am    Post subject: Reply with quote

Cannot currently be done. You will have to use the console remotely to do it. Hopefully in the future Aprelium will be adding a way to use PHP to do such things.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Aug 23, 2006 3:46 pm    Post subject: Re: How to add host remotely Reply with quote

josepi wrote:
Anyone know's about Add a Host remotely using PHP ?

You can do it by updating the abyss.conf from your PHP script and restarting the server.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Wed Aug 23, 2006 3:52 pm    Post subject: Re: How to add host remotely Reply with quote

aprelium wrote:
josepi wrote:
Anyone know's about Add a Host remotely using PHP ?

You can do it by updating the abyss.conf from your PHP script and restarting the server.


That said, it is very difficult to do.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
josepi
-


Joined: 20 Jul 2006
Posts: 30

PostPosted: Wed Aug 30, 2006 9:19 pm    Post subject: Reply with quote

amm but if i add something in abyss.conf when i reload , and i open admin panel , dont show me the new host i add
Back to top View user's profile Send private message
josepi
-


Joined: 20 Jul 2006
Posts: 30

PostPosted: Thu Aug 31, 2006 6:41 am    Post subject: Reply with quote

well i do my self and it's working

this is the code to add

Code:

$fileloc = 'C:\Archivos de programa\Abyss Web Server';

$filelocfile = ($fileloc."\abyss.conf");

$site = "SITE TO ADD";
$ahtml = "AHTML DIRECTORY";

$lines = file($filelocfile);

rename($filelocfile, $fileloc . date("Y-m-d;H-i-s")." abyss.conf" );
 

// open Config for writing
$file = fopen($filelocfile,"a");

for($i=0; $i < sizeof($lines); $i++)
{
fwrite ($file, $lines[$i]);
 
// write new information on top of list after "<Users>"
if (strstr($lines[$i],"here"))
{

fwrite($file, '   <host>
         <port>
            80
         </port>
         <names>
            <name>
               '.$site.'
            </name>
            <name>
               www.'.$site.'
            </name>
         </names>
         <path>
            D:\root\~'.$site.'
         </path>
         <bindip>
            *
         </bindip>
         <indexes>
            <index>
               index.html
            </index>
            <index>
               index.htm
            </index>
            <index>
               default.aspx
            </index>
            <index>
               index.asp
            </index>
            <index>
               index.php
            </index>
         </indexes>
         <dirlist>
            <type>
               1
            </type>
            <order>
               ad
            </order>
            <scope>
               <allow>
                  <path>
                     /
                  </path>
               </allow>
            </scope>
            <hidden>
               <file>
                  .*
               </file>
            </hidden>
            <mimetype>
               text/html; charset=UTF-8
            </mimetype>
         </dirlist>
         <scripting>
            <enabled>
               yes
            </enabled>
            <cgi>
               <timeout>
                  30
               </timeout>
               <usescript>
                  yes
               </usescript>
               <useshebang>
                  yes
               </useshebang>
            </cgi>
            <isapi>
               <ext>
                  dll
               </ext>
               <debuglevel>
                  0
               </debuglevel>
            </isapi>
            <fastcgi>
               <debuglevel>
                  1
               </debuglevel>
               <timeout>
                  240
               </timeout>
            </fastcgi>
            <interpreters>
               <interpreter>
                  <ext>
                     php
                  </ext>
                  <interface>
                     1
                  </interface>
                  <file>
                     D:/ext/'.$site.'/php-cgi.exe
                  </file>
                  <checkexists>
                     yes
                  </checkexists>
                  <type>
                     1
                  </type>
                  <updatepaths>
                     yes
                  </updatepaths>
               </interpreter>
               <interpreter>
                  <ext>
                     asp
                  </ext>
                  <interface>
                     1
                  </interface>
                  <file>
                     '.$ahtml.'
                  </file>
                  <checkexists>
                     yes
                  </checkexists>
                  <type>
                     0
                  </type>
                  <updatepaths>
                     yes
                  </updatepaths>
               </interpreter>
            </interpreters>
            <environment>
               <var>
                  <name>
                     REDIRECT_STATUS
                  </name>
                  <value>
                     200
                  </value>
               </var>
            </environment>
         </scripting>
         <ssi>
            <enabled>
               yes
            </enabled>
            <abbreviatesize>
               yes
            </abbreviatesize>
            <extensions>
               <ext>
                  shtml
               </ext>
               <ext>
                  shtm
               </ext>
               <ext>
                  stm
               </ext>
            </extensions>
         </ssi>
         <log>
            <extendedformat>
               yes
            </extendedformat>
            <file>
               D:/ext/'.$site.'/access.log
            </file>
         </log>
         <customerrors>
            <errors>
               <error>
                  <status>
                     400
                  </status>
                  <url>
                     /Error/error400.html
                  </url>
               </error>
               <error>
                  <status>
                     401
                  </status>
                  <url>
                     /Error/error401.html
                  </url>
               </error>
               <error>
                  <status>
                     402
                  </status>
                  <url>
                     /Error/error402.html
                  </url>
               </error>
               <error>
                  <status>
                     403
                  </status>
                  <url>
                     /Error/error403.html
                  </url>
               </error>
               <error>
                  <status>
                     404
                  </status>
                  <url>
                     /Error/error404.html
                  </url>
               </error>
               <error>
                  <status>
                     405
                  </status>
                  <url>
                     /Error/error405.html
                  </url>
               </error>
            </errors>
         </customerrors>
         <running>
            yes
         </running>
         <users>
            <user>
               <name>
                  none
               </name>
               <password>
                  8dba8e5de4493b41121bd4c2ce9a7356
               </password>
            </user>
         </users>
         <throttle>
            <enabled>
               no
            </enabled>
         </throttle>
         <antileech>
            <strict>
               no
            </strict>
         </antileech>
         <id>
            8
         </id>
      </host>
');
}
}
fclose($file);



you just have to modify the code from you abyss.conf


this is the way to add a host

just have to reload abyss

i make a software my self i anyone want pm me
Back to top View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Thu Aug 31, 2006 11:10 am    Post subject: Reply with quote

No need to double post.

Its good but obviously there is the problem of restarting abyss and making sure it does it and doesnt just crash.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
Tom Chapman
-


Joined: 09 Jul 2005
Posts: 933
Location: Australia

PostPosted: Thu Aug 31, 2006 3:17 pm    Post subject: Reply with quote

Why'd he double post? 8O
Back to top View user's profile Send private message Visit poster's website MSN Messenger
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Aug 31, 2006 3:58 pm    Post subject: Reply with quote

josepi wrote:
just have to reload abyss


The idea is to have a .bat file which will stop the server and start it. This .bat file will be run from the script by using this sequence of commands:

Code:
<?php
       echo 'The server is restarting';
       flush();
       ob_flush();

       exec('start /B cmd.exe /C C:\\Full\\Path\\to\\restart.bat');
?>


C:\\Full\\Path\\to has to be replaced with the full path to restart.bat. Note that backslashes must be doubled because they have a special meaning in PHP strings.

Below you'll find two versions of the .bat file:

* If Abyss Web Server is running as a Windows Service:

restart.bat:

Code:
@echo off
net stop AbyssWebServer
net start AbyssWebServer


* If Abyss Web Server is running in a normal user session:

Code:
@echo off
C:\Path\to\abyssws.exe --stop
C:\Path\to\abyssws.exe


In the above script, replace C:\Path\to\ with the actual path where Abyss Web Server is installed.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
josepi
-


Joined: 20 Jul 2006
Posts: 30

PostPosted: Thu Aug 31, 2006 5:01 pm    Post subject: Reply with quote

Code:

<?
/*

1.
Firts make a backup of abyss.conf
and then go to you abyss.conf
and copy from any host you have
From <host>
To </host>
and paste in $host = 'HERE YOU <host>';
VARIABLES
Remplace for Example in
--------------------------
<port>
            80
         </port>
         <names>
            <name>
               something.com
            </name>
            <name>
               www.something.com
            </name>
--------------------------

This is and example of the firts part of you <host>
Remplace something.com with '.$site.'

like this
--------------------------
         <port>
            80
         </port>
         <names>
            <name>
               '.$site.'
            </name>
            <name>
               www.'.$site.'
            </name>
         </names>
--------------------------

Remplace Ahtml Path with '.$ahtml.'
Remplace Perl Path with '.$perl.'
Remplace PHP Path with '.$php.'



2.

Add "here" to you abyss.conf where you want to add the new host's without ""

3.

create a file called abyss.bat in C:/
with this
If Abyss Run on a Normal Session
in the bat write this

@echo off
C:\Path\to\abyssws.exe --stop
C:\Path\to\abyssws.exe


Reemplace c:\path\to with abyss actual path

but if is a windows service
write in the bat this


@echo off
net stop AbyssWebServer
net start AbyssWebServer


4.

you have to edit
$sitepath
and
$sitelog

down you have an example of a simple use

*/

$batpath = "C:\\";

$host = '   <host>
         <port>
            80
         </port>
         <names>
            <name>
               '.$site.'
            </name>
            <name>
               www.'.$site.'
            </name>
         </names>
         <path>
            '.$sitepath.'
         </path>
         <log>
            <file>
               '.$sitelog.'
            </file>
            <extendedformat>
               yes
            </extendedformat>
         </log>
         <bindip>
            *
         </bindip>
         <indexes>
            <index>
               index.html
            </index>
            <index>
               index.htm
            </index>
            <index>
               default.aspx
            </index>
         </indexes>
         <dirlist>
            <type>
               1
            </type>
            <order>
               ad
            </order>
            <scope>
               <allow>
                  <path>
                     /
                  </path>
               </allow>
            </scope>
            <hidden>
               <file>
                  .*
               </file>
            </hidden>
            <mimetype>
               text/html; charset=UTF-8
            </mimetype>
         </dirlist>
         <scripting>
            <enabled>
               yes
            </enabled>
            <cgi>
               <timeout>
                  30
               </timeout>
               <usescript>
                  yes
               </usescript>
               <useshebang>
                  yes
               </useshebang>
            </cgi>
            <isapi>
               <ext>
                  dll
               </ext>
               <debuglevel>
                  0
               </debuglevel>
            </isapi>
            <fastcgi>
               <debuglevel>
                  1
               </debuglevel>
               <timeout>
                  240
               </timeout>
            </fastcgi>
         </scripting>
         <ssi>
            <enabled>
               yes
            </enabled>
            <abbreviatesize>
               yes
            </abbreviatesize>
            <extensions>
               <ext>
                  shtml
               </ext>
               <ext>
                  shtm
               </ext>
               <ext>
                  stm
               </ext>
            </extensions>
         </ssi>
         <running>
            yes
         </running>
         <id>
            13
         </id>
      </host>';


$fileloc = 'C:\Archivos de programa\Abyss Web Server';

$filelocfile = ($fileloc."\abyss.conf");

$site = "SITE TO ADD";
$sitepath = "path of Site";
$sitelog "access.log path";
$ahtml = 'AHTML FILE';
$perl = 'PERL FILE';
$php = 'PHP FILE';


$lines = file($filelocfile);

rename($filelocfile, $fileloc . date("Y-m-d;H-i-s")." abyss.conf" );
 

// open Config for writing
$file = fopen($filelocfile,"a");

for($i=0; $i < sizeof($lines); $i++)
{
fwrite ($file, $lines[$i]);
 
if (strstr($lines[$i],"here"))
{

fwrite($file, $host);
}
}
fclose($file);

       echo 'The server is restarting';
       flush();
       ob_flush();

       exec('start /B cmd.exe /C '.$batpath.'\\abyss.bat');

?>



Here is The Full Code of Adding a Host By Code
Back to top View user's profile Send private message
Angel
-


Joined: 17 Nov 2003
Posts: 157
Location: Everett, Washington

PostPosted: Wed Feb 14, 2007 3:43 am    Post subject: Reply with quote

Has anyone tested this does it work?
_________________
Noize Pollution | Angel's Online | Free Net Builders | Pagan Portal
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group