CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • [solved] Fatal errors after enabling binary logging in mysql
Pages: [1]

Author Topic: [solved] Fatal errors after enabling binary logging in mysql  (Read 2452 times)

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
[solved] Fatal errors after enabling binary logging in mysql
October 31, 2013, 02:11:51 pm
Hi

Today I discovered I had the drupal devel module running on a production server, and thus disabled it.
Now I get fatal errors using a profile (that is used with drupal user creation/sign-up) and everytime a script runs with an api call to phone create.
Any and all help is very much appreciated - November is THE month for our organization every year, and we have a thousand users, and tens of thousands of visitors. The rest of the year everytning is in hundreds and users in tens. So I'm a bit stressed by this :/
Hope there's a solution - thanks in advance! :) Some messages are in Danish, but I've put translated equivalents in the comments.

Disabling (and enabling) the drupal devel module, gives me this error page (from drush dis devel -v):
Code: [Select]
unlink(drupal/sites/default/files/civicrm/templates_c/en_US/da_DK//%%A1/A1D/A1D7A332%%checkUsernameAvailable.tpl.php): Permission denied File.php:153                      [warning]
unlink(drupal/sites/default/files/civicrm/templates_c/en_US/da_DK//%%ED/EDB/EDBC254D%%Edit.tpl.php): Permission denied File.php:153                                        [warning]
unlink(drupal/sites/default/files/civicrm/templates_c/en_US/da_DK//%%7F/7F9/7F984A8A%%View.tpl.php): Permission denied File.php:153                                        [warning]
unlink(drupal/sites/default/files/civicrm/templates_c/en_US/da_DK//%%28/281/281E443B%%Overlay.tpl.php): Permission denied File.php:153                                     [warning]
unlink(drupal/sites/default/files/civicrm/templates_c/en_US/da_DK//%%40/40D/40D353E1%%fatal.tpl.php): Permission denied File.php:153                                       [warning]
unlink(drupal/sites/default/files/civicrm/templates_c/en_US/da_DK//%%46/467/4679585E%%ReCAPTCHA.tpl.php): Permission denied File.php:153                                   [warning]
fopen(drupal/sites/default/files/civicrm/ConfigAndLog/CiviCRM.e3b555050b7ee3b5852be17a76d8dbcc.log): failed to open stream: Permission denied file.php:216                 [warning]
fopen(drupal/sites/default/files/civicrm/ConfigAndLog/CiviCRM.e3b555050b7ee3b5852be17a76d8dbcc.log): failed to open stream: Permission denied file.php:216                 [warning]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <base href="http://mysite.com/sites/all/modules/civicrm/" />
  <style type="text/css" media="screen">@import url(http://mysite.com/sites/all/modules/civicrm/css/civicrm.css);</style>
  <style type="text/css" media="screen">@import url(http://mysite.com/sites/all/modules/civicrm/css/extras.css);</style>
</head>
<body>
<div id="crm-container" class="crm-container" lang="da" xml:lang="da">
<div class="messages status no-popup">  <div class="icon red-icon alert-icon"></div>
 <span class="status-fatal">Beklager, men vi kan ikke tilbyde dette i øjeblikket.</span> <!-- I'm sorry, but we cannot offer this at the moment -->
    <div class="crm-section crm-error-message"></div>
            <hr style="solid 1px" />
        <div class="crm-section crm-error-message">DB Error: unknown error</div>
            <p><a href="http://mysite.com/" title="Hovedmenu">GÃ¥ tilbage til hjemmeside.</a></p>
</div>
</div>
<script language="JavaScript">
function toggle( element ) {
    var className = element.className;
    if ( className  == 'crm-accordion-wrapper collapsed crm-fatal-error-details-block') {
        element.className = 'crm-accordion-wrapper  crm-fatal-error-details-block';
    } else {
        element.className = 'crm-accordion-wrapper collapsed crm-fatal-error-details-block';
    }
}
</script>
I got rid of the unlink and fopen errors by setting permissions in templates_C and ConfigAndLog dirs.

Trying to use the profile, watchdog says:
Warning: Invalid argument supplied for foreach() i CRM_Core_Error::formatBacktrace() (linje 601 af drupal/sites/all/modules/civicrm/CRM/Core/Error.php).
Notice: Undefined index: args i CRM_Core_Error::formatBacktrace() (linje 601 af drupal/sites/all/modules/civicrm/CRM/Core/Error.php).
In the ConfigAndLog log I can see this:
Code: [Select]
Oct 31 16:45:20  [info] $Fatal Error Details = Array
(
    [message] => Den efterspurgte profil (gid=3) er ugyldig ELLER den er ikke konfigureret til at blive brugt til "Profil"-visninger i dens indstillinger ELLER der findes ingen profil med dette ID ELLER du har ikke rettigheder til at tilg<C3><A5> denne profile. Kontakt venligst sidens adminstrator hvis du har brug for hj<C3><A6>lp.
    [code] =>
) // The profile is invalid or not cofiguret for profile... or there is no profile with this id...


Oct 31 16:45:20  [info] $backTrace = #0 drupal/sites/all/modules/civicrm/CRM/Core/Error.php(315): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 drupal/sites/all/modules/civicrm/CRM/Core/BAO/UFGroup.php(338): CRM_Core_Error::fatal("Den efterspurgte profil (gid=3) er ugyldig ELLER den er ikke konfigureret til...")
#2 drupal/sites/all/modules/civicrm/CRM/Core/BAO/UFGroup.php(233): CRM_Core_BAO_UFGroup::getFields(3, FALSE, 2, 5, FALSE, FALSE, "Profile", 5, NULL, 5)
#3 drupal/sites/all/modules/civicrm/CRM/Profile/Page/Listings.php(149): CRM_Core_BAO_UFGroup::getListingFields(2, 5, FALSE, NULL, FALSE, "Profile", 5)
#4 drupal/sites/all/modules/civicrm/CRM/Profile/Page/Listings.php(283): CRM_Profile_Page_Listings->preProcess()
#5 drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(429): CRM_Profile_Page_Listings->run()
#6 [internal function](): CRM_Core_Invoke::profile((Array:3))
#7 drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(258): call_user_func((Array:2), (Array:3))
#8 drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(70): CRM_Core_Invoke::runItem((Array:13))
#9 drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#10 drupal/sites/all/modules/civicrm/drupal/civicrm.module(436): CRM_Core_Invoke::invoke((Array:3))
#11 [internal function](): civicrm_invoke("profile", "search")
#12 drupal/includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:2))
#13 drupal/index.php(21): menu_execute_active_handler()
#14 {main}

Using phone create API call (inserted above the error) I get the error:
Code: [Select]
$params_phone = array(
 'version' => 3,
 'sequential' => 1,
 'location_type_id' => 3,
 'is_primary' => 1,
 'phone' => $submitted_values['phone'],
 'phone_type_id' => 2,
 'contact_id' => $submitted_values['Contact ID'],
);
$result_phone = civicrm_api('Phone', 'create', $params_phone);

Oct 31 16:44:34  [info] $backTrace = #0 drupal/sites/all/modules/civicrm/CRM/Core/Error.php(751): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::exceptionHandler(Object(DB_Error))
#2 drupal/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 drupal/sites/all/modules/civicrm/packages/DB.php(969): PEAR_Error->PEAR_Error("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary ,
phone...")
#4 drupal/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-1, 16, (Array:2), "INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , phone...")
#5 drupal/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , phone...", "DB_Error",
 TRUE)
#6 drupal/sites/all/modules/civicrm/packages/DB/mysql.php(898): DB_common->raiseError(-1, NULL, NULL, NULL, "1305 ** FUNCTION ncivicrm.civicrm_strip_non_numeric does not exist")
#7 drupal/sites/all/modules/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError()
#8 drupal/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , phone...")
#9 drupal/sites/all/modules/civicrm/packages/DB/DataObject.php(2421): DB_common->query("INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , phone...")
#10 drupal/sites/all/modules/civicrm/packages/DB/DataObject.php(1055): DB_DataObject->_query("INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , phone...")
#11 drupal/sites/all/modules/civicrm/CRM/Core/DAO.php(287): DB_DataObject->insert()
#12 drupal/sites/all/modules/civicrm/CRM/Core/BAO/Phone.php(74): CRM_Core_DAO->save()
#13 drupal/sites/all/modules/civicrm/CRM/Core/BAO/Phone.php(54): CRM_Core_BAO_Phone::add((Array:7))
#14 [internal function](): CRM_Core_BAO_Phone::create((Array:7))
#15 drupal/sites/all/modules/civicrm/api/v3/utils.php(973): call_user_func_array((Array:2), (Array:1))
#16 drupal/sites/all/modules/civicrm/api/v3/Phone.php(56): _civicrm_api3_basic_create("CRM_Core_BAO_Phone", (Array:7))
#17 drupal/sites/all/modules/civicrm/api/api.php(75): civicrm_api3_phone_create((Array:7))
#18 drupal/sites/all/modules/my_module_civicrm_custom_forms/my_module_civicrm_custom_forms.module(114): civicrm_api("Phone", "create", (Array:7))
#19 drupal/includes/ajax.inc(382): my_module_civicrm_custom_forms_form_callback((Array:37), (Array:22))
#20 [internal function](): ajax_form_callback()
#21 drupal/includes/menu.inc(517): call_user_func_array("ajax_form_callback", (Array:0))
#22 drupal/index.php(21): menu_execute_active_handler()
#23 {main}

Any and all help is very much apreciated!

EDIT: changed the title to reflect the real problem - as described in comments below.
« Last Edit: November 07, 2013, 11:43:48 am by andersiversen »

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Fatal errors using api and profiles after disabling drupal devel module
October 31, 2013, 04:32:36 pm

if urgent and u have the $$$ consider hiring someone to take a quick look and fix things from our super awesome partners: https://civicrm.org/providers (maybe web access or osseed)

for the first issue, ensure that the http user has read/write/execute access on: drupal/sites/default/files/civicrm/templates_c

for the third issue, do a menu and trigger rebuild check: http://forum.civicrm.org/index.php/topic,28751.msg123097.html#msg123097 (ensure u r doing this as admin)

the second issue seems to be a permissioning issue. Ensure that the user has the permissions to access that profile

lobo

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: Fatal errors using api and profiles after disabling drupal devel module
November 02, 2013, 05:27:34 pm
Hey

I did rebuild the menu and triggers, and emptied the cache (just forgot to write that I did it).
Users do have access to the profile.

I gave up figuring out what was wrong - my best guess is that something went wrong with the database, or a setting somewhere that is involved with civicrm writing to the database got malformed when disabling devel.

I exported all new contacts and users added since my last backup (luckily we run daily backups and the last backup was from one hour before I disabled devel). I then restored the backup and imported all the new contacts. Problem solved, except that now I don't dare disable the devel module, but I guess we can live with that until I have better time to look into this problem on a test-server.

Thanks for the hint with the partners - we could probably use that another time.

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: Fatal errors using api and profiles after disabling drupal devel module
November 04, 2013, 05:46:01 pm
Oh no!

The errors are back.

It is not just disabling/enabling devel.

It is enabling/diabling any module, that gives me these errors. As far as I can tell it's only civicrm-stuff that fails afterwards, and not all of civicrm, but just the things described above.

How on earth am I going to figure out where the error is?  :'(

Looking at Config and log, the first error immediately after enabling a module is this

Code: [Select]
Nov 05 02:20:52  [info] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] =>
    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER SET utf8)
      RETURNS VARCHAR(255) CHARACTER SET utf8
      DETERMINISTIC
      NO SQL
    BEGIN
      DECLARE output   VARCHAR(255) CHARACTER SET utf8 DEFAULT '';
      DECLARE iterator INT          DEFAULT 1;
      WHILE iterator < (LENGTH(input) + 1) DO
        IF SUBSTRING(input, iterator, 1) IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') THEN
          SET output = CONCAT(output, SUBSTRING(input, iterator, 1));
        END IF;
        SET iterator = iterator + 1;
      END WHILE;
      RETURN output;
    END [nativecode=1419 ** You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)]
    [type] => DB_Error
    [user_info] =>
    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER SET utf8)
      RETURNS VARCHAR(255) CHARACTER SET utf8
      DETERMINISTIC
      NO SQL
    BEGIN
      DECLARE output   VARCHAR(255) CHARACTER SET utf8 DEFAULT '';
      DECLARE iterator INT          DEFAULT 1;
      WHILE iterator < (LENGTH(input) + 1) DO
        IF SUBSTRING(input, iterator, 1) IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') THEN
          SET output = CONCAT(output, SUBSTRING(input, iterator, 1));
        END IF;
        SET iterator = iterator + 1;
      END WHILE;
      RETURN output;
    END [nativecode=1419 ** You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)]
    [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="
    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER SET utf8)
      RETURNS VARCHAR(255) CHARACTER SET utf8
      DETERMINISTIC
      NO SQL
    BEGIN
      DECLARE output   VARCHAR(255) CHARACTER SET utf8 DEFAULT '';
DECLARE iterator INT          DEFAULT 1;
      WHILE iterator < (LENGTH(input) + 1) DO
        IF SUBSTRING(input, iterator, 1) IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') THEN
          SET output = CONCAT(output, SUBSTRING(input, iterator, 1));
        END IF;
        SET iterator = iterator + 1;
      END WHILE;
      RETURN output;
    END [nativecode=1419 ** You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)]"]
)

Nov 05 02:20:52  [info] $backTrace = #0 drupal/sites/all/modules/civicrm/CRM/Core/Error.php(196): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 drupal/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 drupal/sites/all/modules/civicrm/packages/DB.php(969): PEAR_Error->PEAR_Error("DB Error: unknown error", -1, 16, (Array:2), "\n    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER ...")
#4 drupal/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-1, 16, (Array:2), "\n    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER ...")
#5 drupal/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "\n    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER ...", "DB_Error", TRUE)
#6 drupal/sites/all/modules/civicrm/packages/DB/mysql.php(898): DB_common->raiseError(-1, NULL, NULL, NULL, "1419 ** You do not have the SUPER privilege and binary logging is enabled (yo...")
#7 drupal/sites/all/modules/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError()
#8 drupal/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("\n    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER ...")
#9 drupal/sites/all/modules/civicrm/packages/DB/DataObject.php(2421): DB_common->query("\n    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER ...")
#10 drupal/sites/all/modules/civicrm/packages/DB/DataObject.php(1613): DB_DataObject->_query("\n    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER ...")
#11 drupal/sites/all/modules/civicrm/CRM/Core/DAO.php(155): DB_DataObject->query("\n    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER ...")
#12 drupal/sites/all/modules/civicrm/CRM/Core/DAO.php(917): CRM_Core_DAO->query("\n    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER ...", TRUE)
#13 drupal/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php(2964): CRM_Core_DAO::executeQuery("\n    CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER ...")
#14 drupal/sites/all/modules/civicrm/CRM/Core/DAO.php(1550): CRM_Contact_BAO_Contact::triggerInfo((Array:5), NULL)
#15 drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(469): CRM_Core_DAO::triggerRebuild()
#16 drupal/sites/all/modules/civicrm/drupal/civicrm.module(1159): CRM_Core_Invoke::rebuildMenuAndCaches(TRUE)
#17 [internal function](): civicrm_modules_installed((Array:1))
#18 drupal/includes/module.inc(895): call_user_func_array("civicrm_modules_installed", (Array:1))
#19 drupal/includes/module.inc(494): module_invoke_all("modules_installed", (Array:1))
#20 drupal/modules/system/system.admin.inc(1213): module_enable((Array:2), FALSE)
#21 drupal/includes/form.inc(1465): system_modules_submit((Array:28), (Array:18))
#22 drupal/includes/form.inc(861): form_execute_handlers("submit", (Array:28), (Array:18))
#23 drupal/includes/form.inc(374): drupal_process_form("system_modules", (Array:28), (Array:18))
#24 drupal/includes/form.inc(131): drupal_build_form("system_modules", (Array:18))
#25 [internal function](): drupal_get_form("system_modules")
#26 drupal/includes/menu.inc(517): call_user_func_array("drupal_get_form", (Array:1))
#27 drupal/index.php(21): menu_execute_active_handler()
#28 {main}

So is this because the civicrm database user doesn't have SUPER priviledges?
Code: [Select]
[nativecode=1419 ** You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)]"]

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: Fatal errors using api and profiles after disabling drupal devel module
November 04, 2013, 06:03:11 pm
...And that was the problem.

Though I guess it's unsafe to give the civicrm database user SUPER priviledges, so disabling binary logging solves the problem as well.
Phew - I almost started crying there.

I'm not a database expert, but I guess I have to look into what  log_bin_trust_function_creators is about.

First hit on Goolge search is a link to this forum - another guy entered this problem while upgrading CiviCRM:
http://forum.civicrm.org/index.php?topic=26488.0

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • [solved] Fatal errors after enabling binary logging in mysql

This forum was archived on 2017-11-26.