If anybody in the future needs it, here is how it can be done.
First of all you need a 'sudo' version to be installed on your system ('sudo' - is a program which allows you running root commands without actually being root. Pretty easy to find and install it. It's also preinstalled on much racks)
After that create a virtual plan through the ENSIM web interface. Let's call it Plan1.
Now we have to configure the sudo to work properly for us.
Open sudo configuration file using any SSH client under root:
CODE
pico /etc/sudoers
Find the following lines in the opened file :
CODE
## Command Aliases
## These are groups of related commands...
And after them add some code :
CODE
##ENSIM
Cmnd_Alias ENSIM = /usr/local/bin/AddVirtDomain
This is how we created a command alias which will be needed further for giving out permissions.
Now you will need to find this line
CODE
Defaults specification
and comment it, so it'll look like
CODE
# Defaults specification
It'll prevent sudo of giving the error about TTY.
Now somewhere at the end of file insert the following code
CODE
## Allow apache to run AddVitDomain script
apache ALL=(ALL) NOPASSWD: ENSIM
Now save the file by quitting pico (Ctrl+x, answering Y about saving etc).
We are done with the shell part and we can run AddVirtDomain ENSIM script right from our PHP script.
AddVirtDomain has plenty of arguments, you can look through the technical docimentation for advanced use of it. I will show you how to create a virtual site, using a hosting plan, we have created (Plan1)
Here is an example PHP code you need:
CODE
<?php
$string_exec='/usr/bin/sudo /usr/local/bin/AddVirtDomain -p Plan1 -c siteinfo,domain=example.com,admin_user=username,tpasswd=password,email=my@email.
om';
exec($string_exec);
?>
Where
example.com - the desired domain name
username - site admin username
password - site admin password
my@email.com - site admin e-mail.
That's it.
I can also explain how to integrate all this with 2checkout for full automated solution. Just let me know.