![]() |
Virtualmin create server from web form
in a PHP web page i need to run this following command to create a new domain:
Code:
virtualmin create-domain --domain DOMAIN --pass PASS --plan 'Standard Package' --limits-from-plan --features-from-planThanks. |
I do a little PHP programming - according to web documentation I found at http://www.php.net/manual/en/function.exec.php
this is what you need: <?php $command = "program.to.execute 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! |
| All times are GMT -5. The time now is 06:28 AM. |