/dev/null"; $result = system($command); //Error check if ($result != '') { die("\nError encountered while extracting latest wordpress in directory " . $domain['rootdir'] . "\n"); } $command = "mv " . $domain['htdocs'] . "/wordpress/* " . $domain['htdocs'] . "/"; echo "\n COMMAND :: $command \n"; $result = system($command); //Error check if ($result != '') { die("\nError encountered while moving latest wordpress in directory " . $domain['rootdir'] . "\n" . $result); } /** * MySQL Creation */ $command = "mysql -h " . $local_env['mysql_host'] . " -u " . $local_env['mysql_user'] . " -p" . $local_env['mysql_pass'] . " -e 'create database `'" . $domain['name'] . "'` '"; $result = system($command); /* * Create wp-config.php */ $wp_config_sample = $domain['htdocs'] . "/wp-config-sample.php"; $command = "sed s/database_name_here/{$domain['name']}/ $wp_config_sample | sed s/username_here/{$local_env['mysql_user']}/ | sed s/password_here/{$local_env['mysql_pass']}/ > {$domain['htdocs']}/wp-config.php"; $result = system($command); /** * Chown */ $command = "chown -R " . $local_env['nginx_user'] . ":" . $local_env['nginx_group'] . " " . $domain['rootdir']; echo "\n COMMAND :: $command \n"; $result = system($command); //Error check if ($result != '') { die("\nError encountered while charging owner of " . $domain['rootdir'] . "\n" . $result); } /** * ALL SEENS WELL - Restart nginx */ echo "\n Relaoding nginx configuration...\n\n"; system('service nginx reload'); /** * THE END */ //just echo URL for new domain like http://$domain //user will click it and verify if its working fine! ;-) echo $domain['name'] . " Successfully created\n\n"; ?>