Skip to content

Instantly share code, notes, and snippets.

@sadekbaroudi
Created June 9, 2015 07:58
Show Gist options
  • Save sadekbaroudi/f0f3c759df00ce1094f9 to your computer and use it in GitHub Desktop.
Save sadekbaroudi/f0f3c759df00ce1094f9 to your computer and use it in GitHub Desktop.
SugarCRM 7 - Silent Installer
<?php
$sugar_config_si = array (
'default_currency_iso4217' => 'USD',
'default_currency_name' => 'US Dollars',
'default_currency_significant_digits' => '2',
'default_currency_symbol' => '$',
'default_date_format' => 'Y-m-d',
'default_decimal_seperator' => '.',
'default_export_charset' => 'ISO-8859-1',
'default_language' => 'en_us',
'default_locale_name_format' => 's f l',
'default_number_grouping_seperator' => ',',
'default_time_format' => 'H:i',
'export_delimiter' => ',',
'setup_db_admin_password' => 'root', // DATABASE ADMIN USER PASSWORD
'setup_db_admin_user_name' => 'root', // DATABASE ADMIN USER NAME
'setup_db_create_database' => '1', // CREATE THE DATABASE IF IT DOESN'T EXIST
'setup_db_drop_tables' => '1', // DROP THE TABLES IF THEY EXIST
'setup_db_sugarsales_password' => 'root', // THE DATABASE PASSWORD TO USE AFTER INSTALLATION TO CONNECT
'setup_db_sugarsales_password_retype' => 'root', // AGAIN
'setup_db_sugarsales_user' => 'root', // THE DATABASE USER TO USE AFTER INSTALLATION TO CONNECT
'setup_db_type' => 'mysql', // OR OTHER DATABASE TYPE (ibm_db2, etc)
'setup_db_host_name' => 'localhost', // DATABASE HOST LOCATION
'setup_db_port_num' => '3306', // DATABASE PORT
'setup_db_create_sugarsales_user' => 0, // CREATE THE DATABASE USER TO USE AFTER INSTALLATION
'setup_db_database_name' => 'sugarcrm', // THE DATABASE NAME
'setup_db_pop_demo_data' => 0, // (0 or 1) POPULATE DEMO DATA
'dbUSRData' => 'same',
'demoData' => 'yes', // (yes or no) POPULATE DEMO DATA
'setup_license_key' => 'INSERT_YOUR_LICENSE_KEY_HERE', // License Key
'setup_site_admin_user_name'=> 'admin', // SUGAR ADMIN USER NAME
'setup_site_admin_password' => 'asdf', // SUGAR ADMIN PASSWORD
'setup_site_url' => 'http://localhost/sugarcrm', // PATH TO SUGAR INSTANCE VIA URL
'setup_system_name' => '*** My SugarCRM Instance *** '.date('Y-m-d H:i'), // INSTANCE NAME
'setup_fts_type' => 'Elastic', // TYPE OF FULL TEXT SEARCH
'setup_fts_host' => 'localhost', // HOST FOR FULL TEXT SEARCH
'setup_fts_port' => '9200', // PORT NUMBER FOR FULL TEXT SEARCH
);
<?php
// UPDATE FOR YOUR URL
$siURL = "http://localhost/sugarcrm/install.php?goto=SilentInstall&cli=true";
// EXECUTE THROUGH CURL
$ch = curl_init($siURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
// curl_setopt($ch, CURLOPT_VERBOSE, true); // OPTIONAL FOR DEBUGGING CURL CALL
$result = curl_exec($ch);
if (strpos($result, 'Success!') === false) {
throw new Exception(
"Failure in silent install -- Attempted URL: {$siURL}\nOutput: ".var_export($result, true)
);
}
// echo "silent install url is {$siURL}" . PHP_EOL;
// echo "silent install result is {$result}" . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment