Call virtualmin API (create-user.pl) from PHP

6 posts / 0 new
Last post
#1 Sun, 01/31/2010 - 10:04
abrahaj

Call virtualmin API (create-user.pl) from PHP

Hello, 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 domain.com --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

Sun, 01/31/2010 - 10:10
abrahaj

When I try to run /usr/share/webmin/virtual-server/create-user.pl

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

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

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

Mon, 02/01/2010 - 10:14
ronald
ronald's picture

I believe the php script must use Remote API documented here:
http://www.virtualmin.com/documentation/developer/http

Mon, 02/01/2010 - 18:06
abrahaj

Thank you Ronald! This solved my problem :)

Thu, 01/05/2012 - 01:48
wanzhan

But I have a question:in the url" https://yourserver:10000/virtual-server/remote.cgi?program=create- alias&domain=foo.com&from=sales&to=joe@foo.com "what does the "sales" mean?

Thu, 01/05/2012 - 07:34
andreychek

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 "joe@foo.com".

-Eric

Topic locked