3

After moving my Drupal site to a new host, I got the following error in the error logs.

[error] 8707#0: *1 FastCGI sent in stderr: "PHP message: PHP Notice: Constant DATE_RFC7231 already defined in /ext/vhosts/public/includes/bootstrap.inc on line 258

How can I fix it?

My site currently says "The website encountered an unexpected error. Please try again later"

My setup is as follows:

  • Debian 8
  • PHP 7.0.21
  • MySQL 5.6
  • Drupal 7.54

2 Answers 2

2

Are you certain you're running PHP 5 and not a version of PHP 7? I've only ever seen that error when running PHP 7, and it was due to DATE_RFC7231 already defined in PHP 7.0.19 and 7.1.5.

Either way, the patches in that issue were committed and released with 7.55, so it might be worth trying a core update before anything else.

3
  • I've just tried to update site to Drupl 7.55. I ran draush cc all, and refreshe the site, stil the same error. Aug 3, 2017 at 13:13
  • I was also getting this with PHP 7 on a VM on Drupal 7. Downgraded to PHP 5, it went away. This was just this week, too.
    – Kevin
    Aug 3, 2017 at 13:14
  • @Chapabu, actually Drupal 7.55 did fix the error for me. Thanks for the help Aug 3, 2017 at 14:06
0

I solved following this tutorial:
https://webocreation.com/blog/notice-constant-date_rfc7231-already-defined-in-includes-bootstrap-inc-on-line-258/

Open /includes/bootstrap.inc
Go to line number 258
Comment out the following line:

//define(‘DATE_RFC7231’, ‘D, d M Y H:i:s \G\M\T’);

Then add following line:

if (!defined(‘DATE_RFC7231’)) {
define(‘DATE_RFC7231’, ‘D, d M Y H:i:s \G\M\T’);
}
1
  • 1
    There is not need to edit a Drupal core file: It's enough to update to any Drupal 7 version that is higher than 7.54.
    – apaderno
    Sep 16, 2021 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.