function variable_set

cis7 variable_set($name, $value)
cle7 variable_set($name, $value)
elmsmedia7 variable_set($name, $value)
icor7 variable_set($name, $value)
meedjum_blog7 variable_set($name, $value)
mooc7 variable_set($name, $value)

Sets a persistent variable.

Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.


$name: The name of the variable to set.

$value: The value to set. This can be any PHP data type; these functions take care of serialization as necessary.

See also



411 calls to variable_set()
addanother_update_7001 in sites/all/modules/ulmus/addanother/addanother.install
Port over to the new variable storage system.
admin_menu_toggle_modules in sites/all/modules/ulmus/admin_menu/
Menu callback; Enable/disable developer modules.
admin_theme_form_system_themes_form_alter_submit in sites/all/modules/ulmus/admin_theme/admin_theme.module
Process system_themes_form additions submissions.
advagg_cron in sites/all/modules/ulmus/advagg/advagg.module
Implements hook_cron().
advagg_css_compress_admin_settings_form_submit in sites/all/modules/ulmus/advagg/advagg_css_compress/
Clear out the advagg cache bin when the save configuration button is pressed.

... See full list


includes/, line 973
Functions that need to be loaded on every Drupal request.


function variable_set($name, $value) {
  global $conf;

  db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute();

  cache_clear_all('variables', 'cache_bootstrap');

  $conf[$name] = $value;



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.