Call virtualmin API ( from PHP

I would like to create a set of email users under a VirtualMin environment. I have programmed a PHP script that handles the registration, but I would need to create email users as well. I considered the Virtualmin API the easiest way, but I am having some problems.

I call from PHP
system(’/usr/sbin/virtualmin create-user --domain --user user --pass pass --quota 1048576 --real “John Smith”’);
but at first I was getting: /usr/sbin/virtualmin must be run as root

I have commented out the lines that check for user-root at the virtualmin script, but now I get:
Command create-user was not found

I would appreciate some help on this matter. Is it a permissions error still? Is there any easy way to this problem?

Thank you

When I try to run

from another user (other than root), I get:

Error: Script was not run with full path (failed to find /usr/share/webmin/virtual-server/ under )

Script was not run with full path (failed to find /usr/share/webmin/virtual-server/ under )

I believe the php script must use Remote API documented here:

Thank you Ronald! This solved my problem :slight_smile:

But I have a question:in the url"
alias& "what does the “sales” mean?

The “create-alias” option creates an email alias.

So in the above example, using “from=sales” makes the name of the alias “sales”.

And then, sending an email to “sales” will cause that email to go to the mailbox of “”.