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) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Contribution Pages Cause PHP Fatal Error and HTTP 500
Pages: [1]

Author Topic: Contribution Pages Cause PHP Fatal Error and HTTP 500  (Read 1641 times)

edc1

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.2.6
  • CMS version: Drupal 6
  • MySQL version: 5.1
  • PHP version: 5.3
Contribution Pages Cause PHP Fatal Error and HTTP 500
October 03, 2012, 03:48:51 pm
I'm using a fresh install of CiviCRM 4.2.2 on Drupal 6. I've got a contribution page setup with the dummy payment processor for a membership renewal. When I click the button to confirm the contribution I get a 500 - Internal Server error. This is logged in the Apache error log:

[Wed Oct 03 23:37:49 2012] [error] [client 78.86.163.23] PHP Fatal error:  Uncaught <table border="1" cellspacing="0">\n<tr><td colspan="3" bgcolor="#ff9999"> <b>PEAR_Exception</b>: DB Error: constraint violation in <b>unknown</b> on line <b>unknown</b></td></tr>\n<tr><td colspan="3" bgcolor="#ff9999">- <b>DB_Error</b>: DB Error: constraint violation in <b>unknown</b> on line <b>unknown</b></td></tr>\n<tr><td colspan="3" bgcolor="#aaaaaa" align="center"><b>Exception trace</b></td></tr>\n<tr><td align="center" bgcolor="#cccccc" width="20"><b>#</b></td><td align="center" bgcolor="#cccccc"><b>Function</b></td><td align="center" bgcolor="#cccccc"><b>Location</b></td></tr>\n<tr><td align="center">0</td><td>CRM_Core_Error::exceptionHandler(Object(DB_Error))</td><td>unknown:unknown</td></tr>\n<tr><td align="center">1</td><td>call_user_func(Array, Object(DB_Error))</td><td>/var/www/html/sites/all/modules/civicrm/packages/PEAR.php:931</td></tr>\n<tr><td align="center">2</td><td>PEAR_Error->PEAR_Error('DB Error: constr&hellip;', -3, 16, Array, 'INSERT INTO civi&hellip;')</td><td>/var/www/html/sites/ in /var/www/html/sites/all/modules/civicrm/CRM/Core/Error.php on line 676, referer: http://78.86.163.23/civicrm/contribute/transact?_qf_Confirm_display=true&qfKey=49f8c41b640c0972643c30766512c198_5497

I'm at a complete loss as to why this happens. Has anyone seen this before? Any ideas what's wrong?

Thanks.

Em.

edc1

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.2.6
  • CMS version: Drupal 6
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Contribution Pages Cause PHP Fatal Error and HTTP 500
October 04, 2012, 02:51:46 pm
I've managed to stop the fatal errors in PHP. Contribution pages with the dummy payment processor just wont work though. With debugging enabled I get this in the log:

Code: [Select]
Oct 04 22:46:16  [info] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_log (entity_table , entity_id , data , modified_id , modified_date ) VALUES ('civicrm_contact' ,  1432 , 'civicrm_contact,1432' ,  1432 ,  20121004224616 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civitest`.`civicrm_log`, CONSTRAINT `FK_civicrm_log_modified_id` FOREIGN KEY (`modified_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_log (entity_table , entity_id , data , modified_id , modified_date ) VALUES ('civicrm_contact' ,  1432 , 'civicrm_contact,1432' ,  1432 ,  20121004224616 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civitest`.`civicrm_log`, CONSTRAINT `FK_civicrm_log_modified_id` FOREIGN KEY (`modified_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_log (entity_table , entity_id , data , modified_id , modified_date ) VALUES ('civicrm_contact' ,  1432 , 'civicrm_contact,1432' ,  1432 ,  20121004224616 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civitest`.`civicrm_log`, CONSTRAINT `FK_civicrm_log_modified_id` FOREIGN KEY (`modified_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]"]

I'd be really grateful for some pointers on how to fix this.

Thanks.

Em.

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: Contribution Pages Cause PHP Fatal Error and HTTP 500
October 04, 2012, 04:46:41 pm

1. are u logged in? if so, can you log out and log back in again

2. can u check if there is a contact with id 1432 in the civicrm_contact table

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

edc1

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
  • CiviCRM version: 4.2.6
  • CMS version: Drupal 6
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Contribution Pages Cause PHP Fatal Error and HTTP 500
October 07, 2012, 10:08:33 am
Hi lobo,

thanks for the reply. I did have a contact ID 1432  in the civicrm_contact table. I'm not sure how the database got messed up. Clearing out all my Individual contacts so we just had our organisation contact left in the table, then doing a:

Code: [Select]
ALTER TABLE civicrm_contact AUTO_INCREMENT=2;
To get MySQL to start numbering things again from 2 might have helped to get rid of the constraint violation problems.

I also ran through this documentation:

http://wiki.civicrm.org/confluence/display/CRMDOC42/Ensuring+Schema+Integrity+on+Upgrades

To make sure I had a clean DB schema. I'm not sure which one actually fixed things. I tried so may things.

PHP crashing was caused by the SagePay payment processor extension. The problems I found here are in this forum post:

http://forum.civicrm.org/index.php?topic=26248.0

But I'm up and running again now. Phew!
!
Em.

joelfreeborn

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Wordpress 3.4.2
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Contribution Pages Cause PHP Fatal Error and HTTP 500
October 11, 2012, 12:58:14 pm
I'm having similar trouble on Contribution pages when the user clicks 'Confirm Contribution' with PHP Fatal errors occurring and HTTP 500 generated. You can view the page here:
revelationlife.org.uk/donate/

The error being generated is:

PHP Fatal error:  Call to undefined function wp_get_current_user() in /home/sites/revelationlife.org.uk/public_html/wp-includes/capabilities.php on line 1203, referer: revelationlife.org.uk/donate/

Any ideas on how to resolve this? I have updated CiviCRM to 4.2.2 and Wordpress is running 3.4.2

Many thanks,
Joel

joelfreeborn

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Wordpress 3.4.2
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Contribution Pages Cause PHP Fatal Error and HTTP 500
October 11, 2012, 02:57:23 pm
Found a fix for the issue adding require_once('pluggable.php')  to the top of the capabilities.php file. Probably not the best solution but things are working once more!

denishow

  • I’m new here
  • *
  • Posts: 19
  • Karma: 2
  • CiviCRM version: 4.2
  • CMS version: WordPress 3.4.2
  • MySQL version: 5.4
  • PHP version: 5.3.15
Re: Contribution Pages Cause PHP Fatal Error and HTTP 500
March 07, 2013, 02:14:52 am
Yes, this works for me too. I have to make this fix every time I upgrade the version of WordPress.

I also have to do a similar patch to the Contact Form 7 plug-in. (see http://forum.civicrm.org/index.php?topic=27077.0)

Denis

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Contribution Pages Cause PHP Fatal Error and HTTP 500

This forum was archived on 2017-11-26.