触发ISPConfig虚拟主机文件夹创建
问题描述:
我制作了一个脚本,它自己填充所有ISPConfig表,现在我只需要提高一些脚本来创建所需的虚拟主机以及apache工作所需的其他symblink链接。触发ISPConfig虚拟主机文件夹创建
我的脚本像一个魅力工作,因为我可以使用ISPConfig前端正确查看所有数据。
挖掘到ISPConfig面板中,我看到每创建一条记录时触发一个RaiseEvent函数,但我无法追踪它结束的位置以及它如何执行symblink的创建。
也许调用某个函数或cron它可以工作。
我的Ubuntu服务器10.4
答
好吧,我自己应对上使用Apache 2 + PHP 5.3 + MYSQL + ISPConfig 3。
自从版本3 ISPConfig附带一个简单的API,可以让您执行一些操作,如添加FTP用户,网站和数据库。
我离开这里的如何创建一个数据库的例子:
$params_db = array(
'server_id' => '1',
'system_user' => "web10",
'system_group' => 'client0',
'active' => 'y',
'type' => 'mysql',
'database_name' => $NAME,
'database_user' => $NAME,
'database_password' => '123456',
'database_charset' => 'utf8',
'remote_access' => 'n',
);
接下来我们要在ISPConfig面板上创建一个“远程用户”,允许使用网络服务来comunicate。
$soap_username = 'whatever';
$soap_password = 'h4ck3m3';
$soap_location = 'http://localhost:8080/remote/index.php';
$soap_uri = 'http://localhost:8080/remote/';
$client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri));
那么,接下来呢?
接下来我们调用Web服务器的功能是这样的:
try
{
//* Login to the remote server
if($session_id = $client->login($soap_username,$soap_password))
{
echo 'Logged into remote server sucessfully. The SessionID is '.$session_id. "\n";
$client->sites_database_add($session_id, $client_id, $params_db);
//* Logout
if($client->logout($session_id))
{
echo "DB Created\n";
}
}
}
catch (SoapFault $e)
{
die('SOAP Error: '.$e->getMessage());
}
欲了解更多信息,请查阅howtogeek网站的链接:http://www.howtoforge.com/how-to-create-remote-api-scripts-for-ispconfig-3