Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 05-28-2010, 05:12 PM   #1
LQ Newbie
Registered: May 2010
Posts: 1

Rep: Reputation: 0
Virtualmin create server from web form

in a PHP web page i need to run this following command to create a new domain:

virtualmin create-domain --domain DOMAIN --pass PASS --plan 'Standard Package' --limits-from-plan --features-from-plan
This is usually executed in a shell but i don't know how to do it from a web page and also i need to take the domain string and pass string from a web form. Can anyone help with the PHP code as my skills are basic and i have already tried a few things that just don't work.

Old 06-15-2010, 09:51 PM   #2
Registered: May 2007
Location: Newport, Maine, USA
Distribution: Debian 8.7
Posts: 72

Rep: Reputation: 18
I do a little PHP programming - according to web documentation I found at
this is what you need:


$command = " param1, param2, param3, ...";
exec ( $command );

To get the result of the exec use
$result = exec ( $command );
If you need to capture the output use ", $output" after $command and before the closing ).
If you need to capture the return variable(s) from executed programs include ", $return_var" before the closing ).

Note $command is a string variable
$output is a string array
$return_var is an integer array

If the process will be executed in the background and control returned to PHP immediately then use

exec ( $command . " > /dev/null &" ) ;

If you need to capture the output data for another purpose (log file, etc.) replace /dev/null with the name of a file to hold the data. To append the output instead of replacing it use >> instead of >.

The format of the command is:

string exec ( string $command [, array &$output [, int &$return_var ]] )

If PHP is run in safe mode this will fail unless the command being run is located in an area accessible by PHP in safe mode. See the referenced web page for specifics. The documentation there specifies how to determine the cause of exec failure and how to correct it.

Linux users need to be sure scripts are marked as executable (r-x) for the user or group that runs the script. I use r-x for all users and groups using ls -l filename results in
-rwxr-xr-x 1 user group 119901 2004-06-13 10:03 filename

indicating that the owner (user) has read, write and execute permission
the group (group) has read and execute permission
all others have read and execute permission

use "chmod 755 filename" to set the permissions this way. If your scripts are all in one directory or in subdirectories of a directory you may use "chmod 755 *" to change all files in the current directory or "chmod -R 755 *" to change all files in the current directory and all subdirectories to executables.

Hoping this helps!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtualmin/Webmin, Postfix, Virtual server.. problems. Devileyezz Linux - Server 0 11-05-2007 08:05 PM
How to Guide to create your own web server - interested? shazam75 Mandriva 7 10-06-2005 04:11 PM
Web form to upload to FTP server phatboyz Linux - Networking 2 05-18-2005 10:26 AM
Yet Another N00b Question, want to create my own DNS/Web Server Rage2132 Linux - Networking 6 04-25-2005 08:04 AM
how to create a chained js web form ? graziano1968 Programming 2 11-12-2004 03:55 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:16 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration