• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Plesk Subdomain Manager 0.0.2 Beta

H

haggy

Guest
Hi Folks,
after I went mad with the FU***** Plesk subdomain handling I wrote addon for Plesk.

With the "Plesk Sudo Manager" you can manager your Subdomains.

- make easy a forward
- change the webroot to a existing dir of your "normal" webspace in "YOU/PATH/DOMAIN/httpdocs"

In the attachment you can find the first version to test it on you maschine.

Screenshots:
sudo1.jpg

sudo2.jpg


Download:
http://www.haggybear.de/download/sudo.zip

Cya Haggy
 
Wow! Exactly for what i'm searching for :)

But i have a Problem with the function

PHP:
function prepareDomain($dom){
         $toExec = "/usr/local/psa/admin/bin/websrvmng -u --vhost-name=".$dom;
	 $createVhost = str_replace("{DOMAIN}",$dom,DOCROOT)."conf/vhost.conf";

         exec ('./wrapper "1" "0" "'.$createVhost.'"');
	 exec ($toExec);
}

for what is wrapper ? After this function there is no vhost.conf in my conf directory.

$toExec is /usr/local/psa/admin/bin/websrvmng -u --vhost-name=mydomain.de
$createVhost is /var/www/vhosts/mydomain.de/conf/vhost.conf
seems both are ok...

i see always:

Your domain isn't prepared for the extended subdomain administration.
Should the Plesk Sudo Manager do that now?

Thanks for help!

Crazy X
 
Hi!

The wrapper calls the vhost_writer.sh (without thats u can't write the vhost.conf)

the the permissions of "wrapper to 4755"

chmod 4755 wrapper

Then it works!

Greetings
Haggy
 
it don't work :(

but, can it be that php don't allow exec ?
because wenn i just write

exec ('touch datei');

there is no file named datei...
 
Just are question?

U are german, right?

Then lets talk german!!

Ist doch einfacher für beide, oder?
 
Hab mir schon gedacht das du ne German Person bist :)

Ich bin bei HostEurope und habe ein VPS (virtueller Server).
bei phpinfo() steht das die safe_mode "Off" ist. Also ist da schon mal nicht das Problem.

$result = shell_exec("ping ".$ip);
echo "|".$result."|";

funktioniert z.B. leider auch nicht :-(
Wie kann ich den testen ob exec geht?

Hast du ICQ (oder ähnliches)?

Gruß
Dominic
 
Eh, macht doch ned immer alles per ICQ klar;
schreibt zumindest die Ergebnisse hier nieder ;)

Ich bin auch bei HostEurope...


Lonesome Walker
 
things we change:

1. for HostEurope we need to change doit.php

PHP:
if($subdata["php"] == "true"){
        $vhost_set.= '<IfModule [B]sapi_apache2.c[/B]>\\n';
	$vhost_set.= '	php_admin_flag engine on\\n';
	$vhost_set.= '	php_admin_value open_basedir "'.str_replace("{DOMAIN}",$_GET["dom_name"],DOCROOT)."httpdocs/".$_POST["root"].':/tmp"\\n';
	$vhost_set.= '</IfModule>\\n';
	$vhost_set.= '<IfModule mod_php5.c>\\n';
	$vhost_set.= '	php_admin_flag engine on\\n';
	$vhost_set.= '	php_admin_value open_basedir "'.str_replace("{DOMAIN}",$_GET["dom_name"],DOCROOT)."httpdocs/".$_POST["root"].':/tmp"\\n';
	$vhost_set.= '</IfModule>\\n';
 }

2. we change the permission of wrapper to 4755

3. we change the Owner of the Plugin-Dir (where you put your Files inside) to root:psaadm

4. an advise: first set your options for your subdomain in Plesk like php, perl, ... and than make changes with this plugin
 
a little revision from me in the function getDocRoot in funcs.php (red is new source)

function getDocRoot($d,$s)
{
$logFile = $d."/subdomains/".$s."/conf/vhost.conf";
$fa = file($logFile);
if($fa[0] == "") return "/";
$str = str_replace(str_replace("//","/", "DocumentRoot $d/httpdocs/"), "/", $fa[0]);
$str = str_replace("//","/",$str);


return $str;
}

And at the end of the file doit.php (red is new source)

$vhost_set.= "\\nOptions +Includes +ExecCGI\\n";
$vhost_set.= "</Directory>\\n\\n";

if($_POST["secure"] == 1){
$confFile = str_replace("{DOMAIN}",$_GET["dom_name"],DOCROOT)."conf/httpd.include";

$start = '<Directory "';
$middle = 'AuthType';
$stop = '<\/Directory>';

$fp = fopen ($confFile, "r");
$inhalt = fread ($fp, filesize ($confFile));

preg_match_all('/'.$start.'(.+)'.$middle.'(.+)'.$stop.'/sU', $inhalt, $gefunden);

$vhost_set .= str_replace("\n","\\n", str_replace("\t","", implode("\n", $gefunden[0])));

}

$vhost_set = str_replace("//","/",$vhost_set);
$vhost_set = str_replace("\"","\\\"",$vhost_set);


exec ('./wrapper "1" "5" "'.$makeFor.'" "'.$vhost_set.'"');
header("Location: index.php?".$_SERVER["QUERY_STRING"]."&statmessage=SETROOT&sub=".$_POST["sub"]);
exit;
 
Hallo!
Ich habe all eure Fixes gemacht aber trotzdem bekomm ich immer noch die Fehlermeldung
Your domain isn't prepared for the extended subdomain administration.
Should the Plesk Sudo Manager do that now?

Beim Daraufklicken ist erscheint sie wieder !?

Könnt Ihr mir da helfen? Danke!

Gruß,
Ferdi
 
Back
Top